How to use the @lumino/algorithm.map function in @lumino/algorithm

To help you get started, we’ve selected a few @lumino/algorithm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / lumino / packages / datastore / src / datastore.ts View on Github external
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);
  }
github jupyterlab / jupyterlab / packages / completer / src / model.ts View on Github external
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
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
iterUserWidgets(): IIterator {
      let children = map(this.children, child => child.iterUserWidgets());
      return new ChainIterator(children);
    }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
iterSelectedWidgets(): IIterator {
      let children = map(this.children, child => child.iterSelectedWidgets());
      return new ChainIterator(children);
    }
github jupyterlab / lumino / packages / widgets / src / gridlayout.ts View on Github external
iter(): IIterator {
    return map(this._items, item => item.widget);
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
iterUserWidgets(): IIterator {
      return map(this.tabBar.titles, title => title.owner);
    }
github jupyterlab / jupyterlab / packages / completer / src / model.ts View on Github external
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
    }));
  }
github jupyterlab / lumino / packages / datastore / src / datastore.ts View on Github external
toString(): string {
    return JSON.stringify(toObject(
      map(this, (table): [string, Record[]] => {
        return [table.schema.id, toArray(table)];
      })
    ));
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
iterTabBars(): IIterator> {
      let children = map(this.children, child => child.iterTabBars());
      return new ChainIterator>(children);
    }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
iterAllWidgets(): IIterator {
      let children = map(this.children, child => child.iterAllWidgets());
      return new ChainIterator(children);
    }