Function keySelect

  • Selects and returns the value of the specified property from the given object.

    Type Parameters

    • O extends object
    • K extends string | number | symbol

    Parameters

    • condition: K
    • options: O

    Returns O[K]

    Example

    // returns 'bar'
    keySelect('foo', { foo: 'bar' });
    // returns 25
    keySelect(2, [10, 20, 25]);