svelte-ux
Version:
- Increment version in `package.json` and commit as `Version bump to x.y.z` - `npm run publish`
36 lines (35 loc) • 1.52 kB
TypeScript
export declare function isLiteralObject(obj: any): boolean;
export declare function camelCaseKeys(obj: any): any;
export declare function nestedFindByPredicate(obj: any, predicate: (item: any) => boolean, childrenProp?: PropAccessorArg): any | undefined;
export type PropAccessorArg = Parameters<typeof propAccessor>[0];
export declare function propAccessor(prop?: string | ((x: any) => any) | null): (x: any) => any;
export declare function objectId(object: any): any;
export declare function distinctKeys(...objs: object[]): string[];
/**
* Recursive merge objects
* @param object The destination object
* @param source The source object
* @returns
*/
export declare function merge<TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
export type Expiry = Date | {
[prop: string]: Date | {
[prop: string]: Date;
};
};
/**
* Remove properties from object based on expiration
*/
export declare function expireObject<TObject>(object: any, expiry: Expiry): Partial<TObject> | null;
/**
* Remove properties from an object. See also lodash `_.omit()`
*/
export declare function omit<T extends object = {}>(obj: T, keys: string[]): Partial<T>;
/**
* Pick properties from an object. See also lodash `_.pick()`
*/
export declare function pick<T extends object = {}>(obj: T, keys: string[]): Partial<T>;
/**
* Create new object with keys and values swapped. Last value's key is used if duplicated
*/
export declare function keysByValues<T extends object = {}>(obj: T): any;