@wamasimba/ngx-translate-core
Version:
Translation library (i18n) for Angular
55 lines (54 loc) • 2.23 kB
TypeScript
/**
* Determines if two objects or two values are equivalent.
*
* Two objects or values are considered equivalent if at least one of the following is true:
*
* * Both objects or values pass `===` comparison.
* * Both objects or values are of the same type and all of their properties are equal by
* comparing them with `equals`.
*
* @param o1 Object or value to compare.
* @param o2 Object or value to compare.
* @returns true if arguments are equal.
*/
export declare function equals(o1: any, o2: any): boolean;
export declare function isDefinedAndNotNull(value: any): boolean;
export declare function isDict(value: any): boolean;
export declare function isObject(value: any): boolean;
export declare function isArray(value: any): boolean;
export declare function isString(value: any): boolean;
export declare function isFunction(value: any): boolean;
export declare function cloneDeep<T>(obj: Readonly<T>): T;
export declare function mergeDeep(target: Readonly<any>, source: any): any;
/**
* Retrieves a value from a nested object using a dot-separated key path.
*
* Example usage:
* ```ts
* getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA'); // returns 'valueI'
* ```
*
* @param target The source object from which to retrieve the value.
* @param key Dot-separated key path specifying the value to retrieve.
* @returns The value at the specified key path, or `undefined` if not found.
*/
export declare function getValue(target: any, key: string): any;
/**
* Sets a value on object using a dot separated key.
* This function modifies the object in place
* parser.setValue({a:{b:{c: "test"}}}, 'a.b.c', "test2") ==> {a:{b:{c: "test2"}}}
* @param target an object
* @param key E.g. "a.b.c"
* @param value to set
* @deprecated use insertValue() instead
*/
export declare function setValue(target: any, key: string, value: any): void;
/**
* Sets a value on object using a dot separated key.
* Returns a clone of the object without modifying it
* parser.setValue({a:{b:{c: "test"}}}, 'a.b.c', "test2") ==> {a:{b:{c: "test2"}}}
* @param target an object
* @param key E.g. "a.b.c"
* @param value to set
*/
export declare function insertValue(target: Readonly<any>, key: string, value: any): any;