Function pathKeyIterator
-
pathKeyIterator(
data: object,
options?: PathKeyIteratorOptions,
): IterableIterator<readonly PropertyKey[]>Parameters
- data: object
An object to traverse for property path keys.
Optionaloptions: PathKeyIteratorOptionsTraversal options.
Defines bounded traversal options for pathKeyIterator.
Returned paths remain absolute when a prefix is selected.
stopPathmust equal or descend fromprefixPathwhen both are supplied.-
OptionalarrayIndex?: booleanWhether numeric array indexes are included.
-
OptionalhasOwnOnly?: booleanWhether traversal is restricted to enumerable own properties.
-
OptionalmaxDepth?: numberMaximum number of property-key segments traversed beneath a selected prefix, or beneath the root when no prefix is supplied. A value of
0selects only the prefix itself when the iterator supports a prefix. -
OptionalmaxResults?: numberMaximum number of paths or entries yielded by one traversal. Reaching this limit truncates normally.
-
OptionalmaxVisits?: numberMaximum number of object properties or trie nodes processed during iterative traversal. Exceeding this limit throws.
-
OptionalprefixPath?: PropertyPathAbsolute enumerable property path selecting the object branch where traversal begins.
-
OptionalstopPath?: PropertyPathAbsolute property path yielded as terminal while pruning all descendants beneath it.
-
Returns IterableIterator<readonly PropertyKey[]>
An iterator of absolute readonly property-key paths.
- data: object
Returns an iterator of property-key path arrays useful with safeAccess and safeSet by traversing the given object. Enumerable string and symbol keys are included, and numeric array indexes may be enabled.
Traversal may be bounded by absolute property paths relative to
data.prefixPathselects one branch and keeps all yielded paths absolute.stopPathyields the selected path itself and prunes every descendant beneath it.maxDepthlimits traversal relative toprefixPath, or relative to the root when no prefix is supplied. Properties reached at the maximum depth are yielded as terminal paths and are not traversed further.maxResultslimits the number of yielded paths.maxVisitslimits the number of enumerable properties and array indexes inspected; exceeding this budget throws before another property value is read. These limits reduce exposure to unexpectedly broad objects, sparse arrays with extreme lengths, getters, and proxy traps. Exceptions raised by getters or proxy operations are intentionally propagated.When both path bounds are supplied,
stopPathmust equal or descend fromprefixPath. IfmaxDepthis also supplied, traversal stops at whichever boundary is reached first.Note: Keys are only generated for ordinary objects and arrays; Map and Set are not indexed. Array elements are treated as terminal paths even when their values are objects.