deep-trails - v3.0.0-beta.3
    Preparing search index...

    Function deepIterate

    • Iterates deeply through the entries of almost any data structure or object.

      Type Parameters

      • R extends object
      • K = unknown
      • V = unknown
      • P extends object = object

      Parameters

      • object: R

        The root node to start the iteration.

      • callback: Callback<P, K, V, R> = ...

        Function to execute by each node before iterating it.

      • options: Partial<Options<P, K, V>> = deepIterate.options

        Options to customize traversal behavior. Defaults to deepIterate.options.

      Returns Snapshot<R, K, V, P>

      The arguments and visit log in a plain object.

      • Some types of objects are excluded: Date, Promise, RegExp, Error, WeakMap, WeakSet, and functions.
      • Circular references are avoided by default, but you can change this behavior.
      • You can get a visit log by changing the "visitLogType" option.
      • This function performs a depth-first search (DFS).

      Type parameters:

      • R: Root node.
      • K: Keys.
      • V: Child values.
      • P: Parent values.

      TypeError if the arguments are invalid.

      deepIterate(
      { a: { b: { c: [ "d", "f", "g" ] } } },
      (child) => {
      console.log(`${child.path} = ${child.value}`)
      },
      { pathType: "string" }
      );

      3.0.0-beta.3

    Index

    Properties

    Properties

    options: Options<any, any, any>

    Default options argument for deepIterate.

    They are necessary when an option is not entered.

    TypeError if some option is of invalid type.

    3.0.0-beta.0