Object
/ API ReferenceObject
/ API Referencekeys
Returns the keys of the object.
Similar to Object.keys, but with proper type inference.
The Gist
import { keys } from '@weser/object'
const objKeys = keys({ a: 1, b: 2, c: 3 })
// => ['a', 'b', 'c']
console.log(objKeys)
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.