WalkHelper

Tree walking helper

Functions

6
postWalkstatic

Post-walks any hierarchical data structure

ParameterTypeDescription
dataObject

Walking starting point

childrenFnfunction

Function to return data children entries in an array or null if no children exists for the entry

fnfunction

Function to call on each entry

Pre-/Post-walks any hierarchical data structure calling inFn each node when it walks in, and outFn when it walks out.

ParameterTypeDescription
dataObject

Walking starting point

childrenFnfunction

Function to return data children entries in an array or null if no children exists for the entry

inFnfunction

Function to call on each entry upon enter

outFnfunction

Function to call on each entry upon exit

preWalkstatic

Pre-walks any hierarchical data structure

ParameterTypeDescription
dataObject

Walking starting point

childrenFnfunction

Function to return data children entries in an array or null if no children exists for the entry

fnfunction

Function to call on each entry

Pre-walk unordered.

Like preWalk but doesn't reverse children before walk, thus children will be walked last child first - first child last

ParameterTypeDescription
dataObject

Walking starting point

childrenFnfunction

Function to return data children entries in an array or null if no children exists for the entry

fnfunction

Function to call on each entry

Pre-walks any hierarchical data structure, passing along a link to the parent node

ParameterTypeDescription
dataObject

Walking starting point

childrenFnfunction

Function to return data children entries in an array or null if no children exists for the entry

fnfunction

Function to call on each entry, called with parent and node

walkWhilestatic

Pre-walks any hierarchical data structure while the passed fn returns true

ParameterTypeDescription
dataObject

Walking starting point

childrenFnfunction

Function to return data children entries in an array or null if no children exists for the entry

fnfunction

Function to call on each entry. If return false here, it aborts the walk.

Returns: Boolean -

false if the walk was aborted.