Function dataGet

  • Utility to safely access values on a deeply nested structure. If path doesn't exist, return undefined.


    const literal = dataGet([{key:{prop:1}}], '0.key.prop') // === 1;

    Type Parameters

    Type Parameters

    • T


    • data: MaybeArray<Record<string, any>>

      the structure to search.

    • key: string

      the path to the value delimited by '.'

    Returns T | undefined

Generated using TypeDoc