Home > sculp-js > forEachDeep
forEachDeep() function
Tree traversal function (default DFS, supports continue and break operations). Can be used to traverse Array and NodeList type data.
Signature:
typescript
export declare function forEachDeep<V>(tree: ArrayLike<V>, iteratee: (val: V, index: number, currentArr: ArrayLike<V>, tree: ArrayLike<V>, parent: V | null, level: number) => boolean | void, options?: {
childField?: string;
reverse?: boolean;
breadthFirst?: boolean;
isDomNode?: boolean;
}): void;Parameters
Parameter | Type | Description |
|---|---|---|
tree |
| Tree data |
iteratee | (val: V, index: number, currentArr: | Iteratee function. Returns true to continue, false to break. |
options | { childField?: string; reverse?: boolean; breadthFirst?: boolean; isDomNode?: boolean; } | (Optional) Options to customize child element name, reverse traversal, breadth-first traversal. Default: { childField: 'children', reverse: false, breadthFirst: false, isDomNode: false, } |
Returns:
void
{*}