Function get

  • Get the value of a property in an object.

    Example

    const getFoo = get("foo");

    getFoo({ foo: "bar" }); // "bar"
    getFoo({}); // undefined

    Returns

    Curried function with key in context.

    Type Parameters

    • Key extends PropertyKey

    Parameters

    • key: Key

    Returns (<Source>(object: Source) => Source[Key])

      • <Source>(object: Source): Source[Key]
      • Type Parameters

        • Source extends Readonly<Record<Key, unknown>>

        Parameters

        • object: Source

        Returns Source[Key]