UNPKG

flooent

Version:

Fluent interface to provide an expressive syntax for common manipulations.

24 lines (23 loc) 1.22 kB
declare type Key = string | number | symbol; /** * Iterates the entries through the given callback and assigns each result as the key. */ export declare function mapKeys<K extends Key, V, N>(value: Record<K, V>, callback: ((value: V, key: K, index: number) => N)): Record<string, N>; /** * Iterates the entries through the given callback and assigns each result as the value. */ export declare function mapValues<K extends Key, V, N>(value: Record<K, V>, callback: ((value: V, key: K, index: number) => N)): Record<K, N>; export declare function rename<K extends Key, V>(value: Record<K, V>, oldKey: K, newKey: K): Record<string, K>; export declare function pull<K extends Key, V>(value: Record<K, V>, key: K): Record<K, V>[K]; export declare function only<K extends Key, V>(value: Record<K, V>, keys: K[]): { [k: string]: unknown; }; /** * Inverse of `only`. Returns a new map with all keys except for the given keys. */ export declare function except<K extends Key, V>(value: Record<K, V>, keys: K[]): { [k: string]: unknown; }; export declare function toEntries<K extends Key, V = any>(obj: Record<K, V>): [K, V][]; export declare function toMap<K extends Key, V>(obj: Record<K, V>): Map<K, V>; export {};