Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function computeCollapsed(items: ReadonlyArray): boolean[] {
// Allocate the return array and fill it with `false`.
let result = new Array(items.length);
ArrayExt.fill(result, false);
// Collapse the leading separators.
let k1 = 0;
let n = items.length;
for (; k1 < n; ++k1) {
let item = items[k1];
if (!item.isVisible) {
continue;
}
if (item.type !== 'separator') {
break;
}
result[k1] = true;
}
// Hide the trailing separators.
function createResults(scores: IScore[]): SearchResult[] {
// Set up an array to track which scores have been visited.
let visited = new Array(scores.length);
ArrayExt.fill(visited, false);
// Set up the search results array.
let results: SearchResult[] = [];
// Iterate over each score in the array.
for (let i = 0, n = scores.length; i < n; ++i) {
// Ignore a score which has already been processed.
if (visited[i]) {
continue;
}
// Extract the current item and indices.
let { item, categoryIndices } = scores[i];
// Extract the category for the current item.
let category = item.category;
function clearData(handler: IMessageHandler): void {
// Lookup the hooks for the handler.
let hooks = messageHooks.get(handler);
// Clear all messsage hooks for the handler.
if (hooks && hooks.length > 0) {
ArrayExt.fill(hooks, null);
scheduleCleanup(hooks);
}
// Clear all posted messages for the handler.
each(messageQueue, posted => {
if (posted.handler === handler) {
posted.handler = null;
posted.msg = null;
}
});
}