remeda
Version:
A utility library for JavaScript and Typescript.
35 lines (32 loc) • 968 B
TypeScript
import { Simplify, ValueOf } from 'type-fest';
import { T as ToString } from './ToString-DO8zw6jS.js';
type Entry<T> = Simplify<ValueOf<{
[P in Exclude<keyof T, symbol>]-?: [
key: ToString<P>,
value: Required<T>[P]
];
}>>;
/**
* Returns an array of key/values of the enumerable properties of an object.
*
* @param data - Object to return keys and values of.
* @signature
* R.entries(object)
* @example
* R.entries({ a: 1, b: 2, c: 3 }); // => [['a', 1], ['b', 2], ['c', 3]]
* @dataFirst
* @category Object
*/
declare function entries<T extends {}>(data: T): Array<Entry<T>>;
/**
* Returns an array of key/values of the enumerable properties of an object.
*
* @signature
* R.entries()(object)
* @example
* R.pipe({ a: 1, b: 2, c: 3 }, R.entries()); // => [['a', 1], ['b', 2], ['c', 3]]
* @dataLast
* @category Object
*/
declare function entries(): <T extends {}>(data: T) => Array<Entry<T>>;
export { entries };