mobx-bonsai
Version:
A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding
14 lines (13 loc) • 620 B
TypeScript
/**
* Iterates through all children and collects them in a set if the
* given predicate matches.
*
* @param root Root node to get the matching children from.
* @param predicate Function that will be run for every child of the root node.
* @param options An optional object with the `deep` option (defaults to `false`) set to `true` to
* get the children deeply or `false` to get them shallowly.
* @returns A readonly set with the matching children.
*/
export declare function findChildren<T extends object>(root: object, predicate: (node: object) => boolean, options?: {
deep?: boolean;
}): ReadonlySet<T>;