@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
22 lines (21 loc) • 1.24 kB
TypeScript
import { Dict } from "./types.js";
//#region src/utils/object.d.ts
/** Removes keys from an object if their value is undefined. */
declare function filterUndefined<T = Dict>(object: T): Partial<Dict<T>>;
/**
* Recursively deep merges two objects in an immutable fashion, following these rules:
* - Key exists in target and both keys are objects => merge
* - Key exists in target and both keys are arrays => concat (not unique)
* - Key isn't an object, an array or doesn't exist in target => override
*/
declare function merge<S1 extends Dict>(s1: S1): S1;
declare function merge<S1 extends Dict, S2 extends Dict>(s1: S1, s2: S2): S1 & S2;
declare function merge<S1 extends Dict, S2 extends Dict, S3 extends Dict>(s1: S1, s2: S2, s3: S3): S1 & S2 & S3;
declare function merge<S1 extends Dict, S2 extends Dict, S3 extends Dict, S4 extends Dict>(s1: S1, s2: S2, s3: S3, s4: S4): S1 & S2 & S3 & S4;
/**
* Returns the items of an object that meet the condition specified in a callback function.
*/
declare function objectFilter<T extends Dict, K extends keyof T>(object: T, fn: (value: any, key: string, object: T) => boolean): Partial<T>;
//#endregion
export { filterUndefined, merge, objectFilter };
//# sourceMappingURL=object.d.ts.map