/object/entries
stdLists key-value pairs (entries) present in the given object.
Type signature
{
<T>(
o:
| {
[s: string]: T;
}
| ArrayLike<T>
): [string, T][];
(o: {}): [string, any][];
}
Examples
entries({ a: 1, b: 2, c: 3 });
// ⇒ [["a", 1], ["b", 2], ["c", 3]]
Try in REPL
Questions
- How to get entries of an object?
- How to get an array of key-value pairs of an object?