UNPKG

@lou.codes/iterables

Version:
19 lines (18 loc) 684 B
import type { Entry, ReadOnlyRecord } from "@lou.codes/types"; /** * Yields all entries of an object (including symbols). * * @category Generators * @example * ```typescript * const entries = objectEntries({ a: 1, b: 2 }); * entries.next(); // { value: ["a", 1], done: false } * entries.next(); // { value: ["b", 2], done: false } * entries.next(); // { value: undefined, done: true } * ``` * @param input Object to get entries from. * @returns Iterable with entries of the given object (including symbols). */ export declare const objectToEntries: <Key extends PropertyKey, Value>( input: ReadOnlyRecord<Key, Value>, ) => Readonly<IterableIterator<Entry<Key, Value>>>;