Loops
/ API Reference
Loops
/ API Reference

objectKeys

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

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

Returns

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

On this page