ixfx
    Preparing search index...

    Function getField

    • Gets the data at path in object. Assumes '.' separates each segment of path.

      getField({ name: { first: `Thom`, last: `Yorke` }}, `name.first`); // { value: `Thom`  success: true }
      getField({ colours: [`red`, `green`, `blue` ]}, `colours.1`); // { value: `green` success: true }

      Returns an error result with more details, eg { success: false, error: 'Path could not be found' }

      Throws if:

      • path is not a string or empty
      • object is undefined or null

      Type Parameters

      • V

      Parameters

      • object: Record<string, any>

        Object to query

      • path: string

        Path

      • separator: string = ...

        Separator of chunks of path. Defaults to '.'

      Returns Result<V, any>