Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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);
}
widgetExtensions(
widgetName: string
): IIterator {
widgetName = widgetName.toLowerCase();
if (!(widgetName in this._extenders)) {
return empty();
}
return new ArrayIterator(this._extenders[widgetName]);
}
iter(): IIterator {
return this._widget ? once(this._widget) : empty();
}
selectedWidgets(): IIterator {
return this._root ? this._root.iterSelectedWidgets() : empty();
}
iter(): IIterator {
return this._root ? this._root.iterAllWidgets() : empty();
}
tabBars(): IIterator> {
return this._root ? this._root.iterTabBars() : empty>();
}
widgets(): IIterator {
return this._root ? this._root.iterUserWidgets() : empty();
}
handles(): IIterator {
return this._root ? this._root.iterHandles() : empty();
}