@rockcarver/frodo-lib
Version:
A library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.
98 lines • 4.26 kB
TypeScript
export type Json = {
/**
* Compare two json objects
* @param {object} obj1 object 1
* @param {object} obj2 object 2
* @param {string[]} ignoreKeys array of keys to ignore in comparison
* @returns {boolean} true if the two json objects have the same length and all the properties have the same value
*/
isEqualJson(obj1: object, obj2: object, ignoreKeys?: string[]): boolean;
/**
* Deep delete keys and their values from an input object. If a key in object contains substring, the key an its value is deleted.
* @param {Object} object input object that needs keys removed
* @param {String} substring substring to search for in key
* @returns the modified object without the matching keys and their values
*/
deleteDeepByKey(object: any, substring: any): any;
/**
* Deep clone object
* @param {any} obj object to deep clone
* @returns {any} new object cloned from obj
*/
cloneDeep(obj: any): any;
/**
* Deep merge two objects
* @param obj1 first object
* @param obj2 second object
* @returns merged first and second object
*/
mergeDeep(obj1: any, obj2: any): any;
/**
* Get all paths for an object
* @param {any} o object
* @param {string} prefix prefix (path calculated up to this point). Only needed for recursion or to add a global prefix to all paths.
* @param {string} delim delimiter used to separate elements of the path. Default is '.'.
* @returns {string[]} an array of paths
*/
getPaths(o: any, prefix?: string, delim?: string): string[];
findInArray(objs: any[], predicate: any): any;
get(obj: any, path: string[], defaultValue?: any): any;
put(obj: any, value: any, path: string[]): any;
/**
* Deterministic stringify
* @param {any} obj json object to stringify deterministically
* @returns {string} stringified json object
*/
stringify(obj: any): string;
};
declare const _default: () => Json;
export default _default;
/**
* Compare two json objects
* @param {object} obj1 object 1
* @param {object} obj2 object 2
* @param {string[]} ignoreKeys array of keys to ignore in comparison
* @returns {boolean} true if the two json objects have the same length and all the properties have the same value
*/
export declare function isEqualJson(obj1: object, obj2: object, ignoreKeys?: string[]): boolean;
/**
* Deep delete keys and their values from an input object. If a key in object contains or equals substring, the key an its value is deleted.
* @param {Object} object input object that needs keys removed
* @param {String} substring substring to search for in key
* @returns the modified object without the matching keys and their values
*/
export declare function deleteDeepByKey(object: any, substring: string): any;
/**
* Deep clone object
* @param {any} obj object to deep clone
* @returns {any} new object cloned from obj
*/
export declare function cloneDeep(obj: any): any;
/**
* Deep merge two objects
* @param obj1 first object
* @param obj2 second object
* @returns merged first and second object
*/
export declare function mergeDeep(obj1: any, obj2: any): any;
/**
* Get all paths for an object
* This function was explicitly created for the shell command in the Frodo CLI
* and has some special casing that may not leave it generic enough to be used
* for what its name implies.
* @param {any} o object
* @param {string} prefix prefix (path calculated up to this point). Only needed for recursion or to add a global prefix to all paths.
* @param {string} delim delimiter used to separate elements of the path. Default is '.'.
* @returns {string[]} an array of paths
*/
export declare function getPaths(o: any, prefix?: string, delim?: string): string[];
export declare function findInArray(objs: any[], predicate: any): any;
export declare function get(obj: any, path: string[], defaultValue?: any): any;
export declare function put(obj: any, value: any, path: string[]): any;
/**
* Deterministic stringify
* @param obj json object to stringify deterministically
* @returns stringified json object
*/
export declare function stringify(obj: any): string;
//# sourceMappingURL=JsonUtils.d.ts.map