@resk/core
Version:
An innovative TypeScript framework that empowers developers to build applications with a fully decorator-based architecture for efficient resource management. By combining the power of decorators with a resource-oriented design, DecorRes enhances code cla
39 lines (38 loc) • 1.56 kB
TypeScript
/***
* A helper class to handle json
*
*/
export declare class JsonHelper {
/**
* Decycles an object by removing all properties of type function.
*
* @param {any} obj The object to decycle.
* @param {Array<any>} [stack=[]] The stack of objects being processed.
* @returns {object|undefined} The decycled object, or undefined if the object is a function.
*/
static decycle(obj: any, stack?: Array<any>): any;
/**
* Stringifies an object or any value.
*
* @param {any} jsonObj The object to stringify.
* @param {boolean} [decylcleVal=false] Whether to decycle the object before stringifying.
* @returns {string} The stringified object.
*/
static stringify(jsonObj: any, decylcleVal?: boolean): string;
/**
* Checks if a string is a valid JSON string.
*
* @param {any} json_string The string to check.
* @returns {boolean} True if the string is a valid JSON string, false otherwise.
*/
static isJSON(json_string: any): boolean;
/**
* Parses a JSON string recursively.
*
* @param {any} jsonStr The JSON string to parse.
* @param reviver A function that transforms the results. This function is called for each member of the object.
* If a member contains nested objects, the nested objects are transformed before the parent object is.
* @returns {object|null} The parsed object, or null if the string is not a valid JSON string.
*/
static parse(jsonStr: any, reviver?: (this: any, key: string, value: any) => any): any;
}