Object
/ API Reference
Object
/ API Reference

entries

Returns the entries of the object as key-value pairs.
Similar to Object.entries, but with proper type inference.

The Gist

import { entries } from '@weser/object'

const objEntries = entries({ a: 1, b: 2, c: 3 })

// => [['a', 1], ['b', 2], ['c', 3]]
console.log(objEntries)

Parameters

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

Returns

(Array<[keyof T, T[keyof T]]>) The entries of the object as an array of key-value pairs.

On this page