• Returns the value for path, or fallback if the value is null or undefined.

    The path is a string of dot-separated keys (foo.bar.baz). The data is an object of any depth.

    Type Parameters

    • R

    Parameters

    • fallback: R

    Returns ((path) => (<T>(data) => R))

      • (path): (<T>(data) => R)
      • Parameters

        • path: string

        Returns (<T>(data) => R)

          • <T>(data): R
          • Type Parameters

            • T extends Record<string, unknown>

            Parameters

            • data: T

            Returns R

    Example

    props('fallback')('a.b')({ a { b: 'Hello World' } })
    // => "Hello World"

    props('fallback')('a.b.c')({ a { b: 'Hello World' } })
    // => "fallback"

Generated using TypeDoc