@alessiofrittoli/web-utils
Version:
Common TypeScript web utilities
32 lines (30 loc) • 907 B
text/typescript
/**
* Filter object removing falsey values.
*
* @param object The object|array to iterate through.
* @returns The updated object.
*/
declare const filterObject: <T>(object: T) => T;
/**
* Convert Map to Object.
*
* @param map The Map to convert.
* @returns The Object representation of the given Map.
*/
declare const mapToObject: <K extends string, V, R extends Record<K, V> = Record<K, V>>(map: Map<K, V>) => R;
/**
* Clone object.
*
* @param a The object or class instance to clone.
* @returns The cloned object.
*/
declare const cloneObject: <T extends object>(a: T) => T;
/**
* Get an Object key by value.
*
* @param obj The object
* @param value The key value to look for.
* @returns The given object key name.
*/
declare const getObjectKey: <T extends object>(obj: T, value: ValueOf<T>) => string | undefined;
export { cloneObject, filterObject, getObjectKey, mapToObject };