Files
personal_site/frontend/node_modules/@aws-cdk/toolkit-lib/lib/util/objects.d.ts
T

70 lines
2.5 KiB
TypeScript
Raw Normal View History

import type { Obj } from './types';
/**
* Return a new object by adding missing keys into another object
*/
export declare function applyDefaults(hash: any, defaults: any): any;
/**
* Return whether the given parameter is an empty object or empty list.
*/
export declare function isEmpty(x: any): boolean;
/**
* Deep clone a tree of objects, lists or scalars
*
* Does not support cycles.
*/
export declare function deepClone(x: any): any;
/**
* Map over an object, treating it as a dictionary
*/
export declare function mapObject<T, U>(x: Obj<T>, fn: (key: string, value: T) => U): U[];
/**
* Construct an object from a list of (k, v) pairs
*/
export declare function makeObject<T>(pairs: Array<[string, T]>): Obj<T>;
/**
* Deep get a value from a tree of nested objects
*
* Returns undefined if any part of the path was unset or
* not an object.
*/
export declare function deepGet(x: any, path: string[]): any;
/**
* Deep set a value in a tree of nested objects
*
* Throws an error if any part of the path is not an object.
*/
export declare function deepSet(x: any, path: string[], value: any): void;
/**
* Recursively merge objects together
*
* The leftmost object is mutated and returned. Arrays are not merged
* but overwritten just like scalars.
*
* If an object is merged into a non-object, the non-object is lost.
*/
export declare function deepMerge(...objects: Array<Obj<any> | undefined>): Obj<any>;
/**
* Splits the given object into two, such that:
*
* 1. The size of the first object (after stringified in UTF-8) is less than or equal to the provided size limit.
* 2. Merging the two objects results in the original one.
*/
export declare function splitBySize(data: any, maxSizeBytes: number): [any, any];
type Exclude = {
[key: string]: Exclude | true;
};
/**
* This function transforms all keys (recursively) in the provided `val` object.
*
* @param val - The object whose keys need to be transformed.
* @param transform - The function that will be applied to each key.
* @param exclude - The keys that will not be transformed and copied to output directly
* @returns A new object with the same values as `val`, but with all keys transformed according to `transform`.
*/
export declare function transformObjectKeys(val: any, transform: (str: string) => string, exclude?: Exclude): any;
/**
* Remove undefined values from a dictionary
*/
export declare function noUndefined<A>(xs: Record<string, A>): Record<string, NonNullable<A>>;
export {};
//# sourceMappingURL=objects.d.ts.map