Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(resolve => {
let trie;
from(function (count, callback) {
if (searchableItems && count >= searchableItems.length) this.emit('end');
this.emit('data', searchableItems[count]);
callback();
}).pipe(through(value => {
if (typeof value === 'object') {
if (!trie) trie = new TrieSearch(null, trieOptions);
trie.addFromObject(value);
resolve(trie);
return;
}
if (!trie) trie = new TrieSearch('value', trieOptions);
trie.add({value});
resolve(trie);
}));
});
};
return new Promise(resolve => {
let trie;
from(function (count, callback) {
if (searchableItems && count >= searchableItems.length) this.emit('end');
this.emit('data', searchableItems[count]);
callback();
}).pipe(through(value => {
if (typeof value === 'object') {
if (!trie) trie = new TrieSearch(null, trieOptions);
trie.addFromObject(value);
resolve(trie);
return;
}
if (!trie) trie = new TrieSearch('value', trieOptions);
trie.add({value});
resolve(trie);
}));
});
};
yield()
{
focusQueue = from(focusQueue)
.without(this)
.toArray();
}
}
takeFocus()
{
focusQueue = from(focusQueue)
.without(this)
.plus(this)
.ascending(it => it._priority)
.toArray();
}