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.
in
obj
The target object to inspect
Property keys to verify, including inherited properties
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')) { ... } Copy
if (hasKeys(config, 'dialect')) { ... }if (hasKeys(options, 'from', 'to')) { ... }
Asserts whether an object has one or more keys (using the
inoperator, unwrapping Proxies if present). Safe against null, undefined, and non-object primitives. Narrowsobjto a record containing the specified keys.