1 | import { Obj } from './types';
|
2 | /**
|
3 | * Return a new object by adding missing keys into another object
|
4 | */
|
5 | export declare function applyDefaults(hash: any, defaults: any): any;
|
6 | /**
|
7 | * Return whether the given parameter is an empty object or empty list.
|
8 | */
|
9 | export declare function isEmpty(x: any): boolean;
|
10 | /**
|
11 | * Deep clone a tree of objects, lists or scalars
|
12 | *
|
13 | * Does not support cycles.
|
14 | */
|
15 | export declare function deepClone(x: any): any;
|
16 | /**
|
17 | * Map over an object, treating it as a dictionary
|
18 | */
|
19 | export declare function mapObject<T, U>(x: Obj<T>, fn: (key: string, value: T) => U): U[];
|
20 | /**
|
21 | * Construct an object from a list of (k, v) pairs
|
22 | */
|
23 | export declare function makeObject<T>(pairs: Array<[string, T]>): Obj<T>;
|
24 | /**
|
25 | * Deep get a value from a tree of nested objects
|
26 | *
|
27 | * Returns undefined if any part of the path was unset or
|
28 | * not an object.
|
29 | */
|
30 | export declare function deepGet(x: any, path: string[]): any;
|
31 | /**
|
32 | * Deep set a value in a tree of nested objects
|
33 | *
|
34 | * Throws an error if any part of the path is not an object.
|
35 | */
|
36 | export declare function deepSet(x: any, path: string[], value: any): void;
|
37 | /**
|
38 | * Recursively merge objects together
|
39 | *
|
40 | * The leftmost object is mutated and returned. Arrays are not merged
|
41 | * but overwritten just like scalars.
|
42 | *
|
43 | * If an object is merged into a non-object, the non-object is lost.
|
44 | */
|
45 | export declare function deepMerge(...objects: Array<Obj<any> | undefined>): Obj<any>;
|
46 | /**
|
47 | * Splits the given object into two, such that:
|
48 | *
|
49 | * 1. The size of the first object (after stringified in UTF-8) is less than or equal to the provided size limit.
|
50 | * 2. Merging the two objects results in the original one.
|
51 | */
|
52 | export declare function splitBySize(data: any, maxSizeBytes: number): [any, any];
|