Function hasKey

  • Checks if a key or an array of keys exists on an object

    Example

    const obj = {
    "foo": true,
    "bar": false
    };

    hasKey(obj, 'foo');
    => true

    hasKey(obj, ['foo', 'bar']);
    => true

    Type Parameters

    • Type extends Record<string | number | symbol, unknown>

    • Key extends string | number | symbol

    Parameters

    • a: Type

      An object

    • keys: Key | Key[]

      The keys to check

    Returns boolean

Generated using TypeDoc