Library API
    Preparing search index...

    Function hasKeys

    • Asserts whether an object has one or more keys (using the in operator, unwrapping Proxies if present). Safe against null, undefined, and non-object primitives. Narrows obj to a record containing the specified keys.

      Type Parameters

      • K extends PropertyKey

      Parameters

      • obj: unknown

        The target object to inspect

      • ...keys: K[]

        Property keys to verify, including inherited properties

      Returns obj is Record<K, unknown>

      True if the target contains all specified keys; with no keys, true for objects and functions

      Errors from proxy traps or getters used while unwrapping or checking keys propagate to the caller.

      if (hasKeys(config, 'dialect')) { ... }
      if (hasKeys(options, 'from', 'to')) { ... }