Loops
/ API ReferenceLoops
/ API ReferenceobjectKeys
Returns the keys of the object.
Similar to Object.keys
, but with proper type inference.
The Gist
import { objectKeys } from '@weser/loops'
const keys = objectKeys({ a: 1, b: 2, c: 3 })
// => ['a', 'b', 'c']
console.log(keys)
Parameters
Parameter | Type | Description |
---|---|---|
obj | Record<PropertyKey, any> | The object to get the keys of. |
Returns
(Array<PropertyKey>
) The keys of the object.
© 2024-present Robin Weser. All Rights Reserved.