UNPKG

react-json-editor-ajrm-ts-platform

Version:

A stylish, editor-like, modular, react component for viewing, editing, and debugging javascript object syntax!

269 lines 12.1 kB
/** * @author Andrew Redican <andrew.redican.mejia@gmail.com> */ /** * Performs deep search on object tree, removes all properties with matching key, returns a new identity without the specified property * @param {Any} identity * @param {string} keyName * @param {Optional Number} maxDepth * @return {Any} identity */ export declare function deepRemoveAll_Key(identity: any, keyName: string, maxDepth?: number): any; /** * Performs deep search on object tree, removes the first property with matching key, returns a new identity without the specified property * @param {Any} identity * @param {string} keyName * @param {Optional Number} maxDepth * @return {Any} identity */ export declare function deepRemove_Key(identity: any, keyName: any, maxDepth: any): any; /** * Performs deep search on object tree, and renames the all matching keys * @param {Any} identity * @param {string} keyName * @param {string} newKeyName * @param {Optional Number} maxDepth * @return {Any} identity */ export declare function renameKeys(identity: any, keyName: any, newKeyName: any, maxDepth?: any): any; /** * Performs deep search on object tree, then renames the first matching key * @param {Any} identity * @param {string} keyName * @param {string} newKeyName * @param {Optional Number} maxDepth * @return {Any} identity */ export declare function renameKey(identity: any, keyName: any, newKeyName: any, maxDepth: any): any; /** * Creates a non-reference clone that is an exact copy to the identity provided. * @param {Any} identity * @param {Optional Number} maxDepth * @param {Optional Number} startDepth * @return {Any} identity */ export declare function deepClone(identity: any, maxDepth?: number, startDepth?: number): any; /** * Performs deep search on collection to find all matches to the key name, and returns a list of identities containing the matched instances. If no matches found, it returns `undefined`. * @param {Any} collection * @param {Any} keyName * @param {Optional Number} maxDepth * @return {Array || undefined} Identities */ export declare function deepFilter_Key(collection: any, keyName: any, maxDepth?: number): any[]; /** * Performs deep search on collection to find all matches to the key name, returns the location of each match in a string array. If no matches found, it returns `false`. * @param {Any} collection * @param {Any} keyName * @param {Optional Number} maxDepth * @return {Array || false} Paths */ export declare function locateAll_Key(collection: any, keyName: string, maxDepth?: number): false | any[]; /** * Performs deep search on collection to find a match to the key name, and returns the first identity containing the match. If no match found, it returns `undefined`. * @param {Any} collection * @param {Any} keyName * @param {Optional number} maxDepth * @return {Identity || undefined} identity */ export declare function deepGet_Key(collection: any, keyName: string, maxDepth?: number): any; /** * Performs deep search on collection to find a match to the key name, will return the path of the first instance matched. If no match found, it returns `false`. * @param {Any} collection * @param {Any} keyName * @param {Optional number} maxDepth * @return {String || false} Path */ export declare function locate_Key(collection: any, keyName: string, maxDepth?: number): any; /** * Performs deep search for identity on collection to return the location's depth of the first match. If no match found, it returns `false`. * @param {Any} collection * @param {Any} identity * @param {Optional Number} maxDepth * @return {boolean} */ export declare function matchDepth(collection: any, identity: any, maxDepth?: number): any; /** * Walks through the entire object tree to return the maximum number of layers it contains. * @param {Any} identity * @param {Optional Number} maxLayer */ export declare function maxDepth(identity: any, maxLayer?: number): number; /** * Performs deep search for identity on collection, returns the number of matches found. * @param {Any} collection * @param {Any} identity * @param {Number} nthDepth * @param {Optional Number} maxDepth * @return {Any} Returns number of matches found. */ export declare function countMatches(collection: any, identity: any, nthDepth?: number, maxDepth?: number): any; /** * Performs deep search for each identity on collection, to shorten the identities to those that meets the match criteria * @param {Any} collection * @param {Any} identities * @param {Any} property * @param {Optional Number} maxDepth * @return {Any} Returns a collection of the same type as the 'identities' parameter provided with only the identities that matched. */ export declare function onlyFalsy(collection: any, identities: any, property: any, maxDepth?: number): any; /** * Performs deep search on collection to find any match to the property and evalutates if truthy * @param {Any} collection * @param {Property} identity * @param {Optional Number} maxDepth * @return {boolean} If match confirmed and truthy will return true, otherwise false */ export declare function foundFalsy(collection: any, identity: any, maxDepth?: any): boolean; /** * Performs deep search for each identity on collection, to shorten the identities to those that meets the match criteria * @param {Any} collection * @param {Any} identities * @param {Any} property * @param {Optional Number} maxDepth * @return {Any} Returns a collection of the same type as the 'identities' parameter provided with only the identities that matched. */ export declare function onlyTruthy(collection: any, identities: any, property: any, maxDepth?: number): any; /** * Performs deep search on collection to find any match to the property and evalutates if truthy * @param {Any} collection * @param {Property} identity * @param {Optional Number} maxDepth * @return {boolean} If match confirmed and truthy will return true, otherwise false */ export declare function foundTruthy(collection: any, identity: any, maxDepth?: number): boolean; /** * Validates if identity is equal to a property definition or contains a single property key. * @param {Property} identity * @return {String || boolean} If criteria matched will return property name as string, otherwise false */ export declare function singleProperty(identity: any): any; /** * Determines if identity is non-falsy * @param {Any} identity * @return {boolean} Returns true if criteria matched, otherwise false. */ export declare function isTruthy(identity: any): boolean; /** * Determines if identity is falsy * @param {Any} identity * @return {boolean} Returns true if criteria matched, otherwise false. */ export declare function isFalsy(identity: any): boolean; /** * Converts false-like values into actual boolean value of false * @param {Any} identity * @return {Any || boolean} Returns false is value is falsy, otherwise returns original value. */ export declare function falser(identity: any): any; /** * Check the length of the top-most depth of the identity * @param {Any} identity * @return {integer} Greater than or equal to 0. */ export declare function getLength(identity: any): any; /** * Performs deep search for each identity on collection, to shorten the identities to those that does meets the match criteria * @param {Any} collection * @param {Any} identities * @param {Optional Number} maxDepth * @return {Any} Returns a collection of the same type as the 'identities' parameter provided with only the identities that were not matched. */ export declare function onlyMissing(collection: any, identities: any, maxDepth?: number): any; /** * Performs deep search for each identity on collection, to shorten the identities to those that meets the match criteria * @param {Any} collection * @param {Any} identities * @param {Optional Number} maxDepth * @return {Any} Returns a collection of the same type as the 'identities' parameter provided with only the identities that matched. */ export declare function onlyExisting(collection: any, identities: any, maxDepth?: any): any; /** * Performs deep search on collection to find any match to the identity * @param {Any} collection * @param {Any} identity * @param {Optional Number} maxDepth * @param {Optional Number} currentDepth * @return {boolean} If a match is confirmed will return true, otherwise false */ export declare function exists(collection: any, identity: any, maxDepth?: any, currentDepth?: number): boolean; /** * Performs deep search on collection to find all matches to the identity, will return a list of identities containing the match. If no matches found, it returns `undefined`. * @param {Any} collection * @param {Any} identity * @param {Optional Number} maxDepth * @return {Array || undefined} identities */ export declare function deepFilter(collection: any, identity: any, maxDepth?: any): any; /** * Performs deep search on collection to find all matches to the identity, returns a string array containing the location of all matches. If no matches found, it returns `false`. * @param {Any} collection * @param {Any} identity * @param {Optional Number} maxDepth * @return {Array || false} Paths */ export declare function locateAll(collection: any, identity: any, maxDepth?: number): any; /** * Performs deep search on collection to find a match to the identity, will return the identity containing of the first instance matched. If no matches found, it returns `undefined`. * @param {Any} collection * @param {Any} identity * @param {Optional Number} maxDepth * @return {identity || undefined} identity */ export declare function deepGet(collection: any, identity: any, maxDepth?: any): any; /** * Performs deep search on collection to find a match to the identity, will return the path of the first instance matched as string. If no matches found, returns `false`. * @param {Any} collection * @param {Any} identity * @param {Optional number} maxDepth * @return {string || false} path */ export declare function locate(collection: any, identity: any, maxDepth?: any): any; /** * Trims an identity to only contain the specified properties. * @param {Any} identity * @param {Any} keyList * @return {Object or Array} Returns , otherwise false */ export declare function trim(identity: any, keyList: any): {}; /** * Check if identity contains all of the specified keys * @param {Any} identity * @param {Array} keyList * @return {boolean} true || false */ export declare function containsKeys(identity: any, keyList: any): boolean; /** * Check if identity has one or more keys to iterate * @param {Any} identity * @return {boolean} true || false */ export declare function isIterable(identity: any): boolean; /** * Compares two identities, will return either true if identical, otherwise false. * @param {Any} identityA * @param {Any} identityB * @return {boolean} true || false */ export declare function identical(identityA: any, identityB: any): any; /** * Compares data structure of two identities, will return either the dataType or true/false. * @param {Any} identityA * @param {Any} identityB * @return {String || False} DataType as string for positive match, otherwise false */ export declare function sameStructure(identityA: any, identityB: any): boolean | "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null" | "array"; /** * Compares data type of two identities, will dataType if true. * @param {Any} identityA * @param {Any} identityB * @return {boolean} true || false */ export declare function sameType(identityA: any, identityB: any): false | "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null" | "array"; /** * Gets data type; makes distintion between object, array, and null. * @param {Any} identity * @return {String} dataType */ export declare function getType(identity: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null" | "array"; //# sourceMappingURL=index.d.ts.map