ixfx
    Preparing search index...

    Function traceRecordEntryByPath

    • Enumerates over children of node towards the node named in path. This is useful if you want to get the interim steps to the target node.

      Use getRecordEntryByPath if you don't care about interim steps.

      const people = {
      jane: {
      address: {
      postcode: 1000,
      street: 'West St',
      city: 'Blahville'
      },
      colour: 'red'
      }
      }
      for (const p of Trees.traceByPath('jane.address.street', people)) {
      // { name: "jane", value: { address: { postcode: 1000,street: 'West St', city: 'Blahville' }, colour: 'red'} },
      // { name: "address", value: { postcode: 1000, street: 'West St', city: 'Blahville' } },
      // { name: "street", value: "West St" } }
      }

      Results stop when the path can't be followed any further. The last entry will have a name of the last sought path segment, and undefined as its value.

      Type Parameters

      • T extends object

      Parameters

      • path: string

        Path to traverse

      • node: T

        Starting node

      • options: Records.PathOpts = {}

        Options for path traversal logic

      Returns Iterable<
          Readonly<
              { ancestors: string[]; name: string; nodeValue: any; sourceValue: any },
          >,
      >