How to use the @lumino/algorithm.empty 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 / collections / src / bplustree.ts View on Github external
// Normalize the stop index.
    if (stop === undefined) {
      stop = -1;
    } else if (stop < 0) {
      stop = Math.max(-1, stop + node.size);
    } else {
      stop = Math.min(stop, node.size - 1);
    }

    // Compute the effective count.
    let count = Math.max(0, start - stop);

    // Bail early if there is nothing to iterate.
    if (count === 0) {
      return empty();
    }

    // Find the starting leaf node and local index.
    while (node.type === NodeType.Branch) {
      let i = findPivotIndexByIndex(node.sizes, start);
      if (i > 0) start -= node.sizes[i - 1];
      node = node.children[i];
    }

    // Return the retro iterator for the range.
    return new RetroIterator(node, start, count);
  }
github jupyterlab / jupyterlab / packages / docregistry / src / registry.ts View on Github external
widgetExtensions(
    widgetName: string
  ): IIterator {
    widgetName = widgetName.toLowerCase();
    if (!(widgetName in this._extenders)) {
      return empty();
    }
    return new ArrayIterator(this._extenders[widgetName]);
  }
github jupyterlab / lumino / packages / widgets / src / singletonlayout.ts View on Github external
iter(): IIterator {
    return this._widget ? once(this._widget) : empty();
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
selectedWidgets(): IIterator {
    return this._root ? this._root.iterSelectedWidgets() : empty();
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
iter(): IIterator {
    return this._root ? this._root.iterAllWidgets() : empty();
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
tabBars(): IIterator> {
    return this._root ? this._root.iterTabBars() : empty>();
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
widgets(): IIterator {
    return this._root ? this._root.iterUserWidgets() : empty();
  }
github jupyterlab / lumino / packages / widgets / src / docklayout.ts View on Github external
handles(): IIterator {
    return this._root ? this._root.iterHandles() : empty();
  }