Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
storeId: options.id,
change: {},
patch: {},
};
let tables = new BPlusTree>(Private.recordCmp);
if (options.restoreState) {
// If passed state to restore, pass the intital state to recreate each
// table
let state = JSON.parse(options.restoreState);
tables.assign(map(schemas, s => {
return Table.recreate(s, context, state[s.id] || []);
}));
} else {
// Otherwise, simply create a new, empty table
tables.assign(map(schemas, s => {
return Table.create(s, context);
}));
}
return new Datastore(context, tables, options.adapter);
}
private _filter(): IIterator {
let options = this._options || [];
let query = this._query;
if (!query) {
return map(options, option => ({ raw: option, text: option }));
}
let results: Private.IMatch[] = [];
for (let option of options) {
let match = StringExt.matchSumOfSquares(option, query);
if (match) {
let marked = StringExt.highlight(option, match.indices, Private.mark);
results.push({
raw: option,
score: match.score,
text: marked.join('')
});
}
}
return map(results.sort(Private.scoreCmp), result => ({
text: result.text,
raw: result.raw
iterUserWidgets(): IIterator {
let children = map(this.children, child => child.iterUserWidgets());
return new ChainIterator(children);
}
iterSelectedWidgets(): IIterator {
let children = map(this.children, child => child.iterSelectedWidgets());
return new ChainIterator(children);
}
iter(): IIterator {
return map(this._items, item => item.widget);
}
iterUserWidgets(): IIterator {
return map(this.tabBar.titles, title => title.owner);
}
if (!query) {
return map(options, option => ({ raw: option, text: option }));
}
let results: Private.IMatch[] = [];
for (let option of options) {
let match = StringExt.matchSumOfSquares(option, query);
if (match) {
let marked = StringExt.highlight(option, match.indices, Private.mark);
results.push({
raw: option,
score: match.score,
text: marked.join('')
});
}
}
return map(results.sort(Private.scoreCmp), result => ({
text: result.text,
raw: result.raw
}));
}
toString(): string {
return JSON.stringify(toObject(
map(this, (table): [string, Record[]] => {
return [table.schema.id, toArray(table)];
})
));
}
iterTabBars(): IIterator> {
let children = map(this.children, child => child.iterTabBars());
return new ChainIterator>(children);
}
iterAllWidgets(): IIterator {
let children = map(this.children, child => child.iterAllWidgets());
return new ChainIterator(children);
}