Object
/ API Reference
Object
/ API Reference

keys

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

ParameterTypeDescription
objRecord<PropertyKey, any>The object to get the keys of.

Returns

(Array<PropertyKey>) The keys of the object.

On this page