Skip to main content

Function: findChildren()

function findChildren<T>(
root,
predicate,
options?
): ReadonlySet<T>;

Iterates through all children and collects them in a set if the given predicate matches.

Type Parameters​

Type ParameterDefault type
T extends objectany

Parameters​

ParameterTypeDescription
rootobjectRoot object to get the matching children from.
predicate(node) => booleanFunction that will be run for every child of the root object.
options?{ deep?: boolean; }An optional object with the deep option (defaults to false) set to true to get the children deeply or false to get them shallowly.
options.deep?boolean-

Returns​

ReadonlySet<T>

A readonly set with the matching children.