UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

53 lines (52 loc) 2.27 kB
interface JSResponse<T> { /** results wanted, it will always be of the desired type */ response: T | undefined; /** if true, response if valid, if false: response was forced * casted clean and it will not be correct, expect error */ valid: boolean; /** * it will contain the error message if valid is false */ error: string | undefined; /** * original value being operated on */ value: any; } export default class JS { /** * @param srcObj an object with the properties in any order * @param map [optional]: the property map generated by parse above. * @param separator [optional]: a non-empty string that controls what the key separator is in the generated map. Defaults to ~. * If the map is unset, the response is a standard JSON.stringify. * @param space [optional]: a number used to insert white space into the output JSON string * for readability purposes, as per the JSON.stringify * @returns */ static jsonStringify: (srcObj: object, map?: any, separator?: string) => string; static jsonParse: (src: string) => import("json-order/dist/models").OrderedParseResult<object>; static stringify(value: object, pretty?: boolean, jsonNotation?: boolean): JSResponse<string>; static jsSingleQuotesToDouble(value: string): string; static jsStringObjectToJSONObject(value: string): string; /** * Check if a string has valid JSON object syntax * @param text string to check if valid json * @returns false if not valid json, true if valid json */ static testJSON: (text: string) => boolean; static jsStringToObject(value: string, retry?: boolean): JSResponse<object>; static prettify(value: string): string; static objectToString(obj: any, jsonNotation?: boolean): string; static escapeJSON(string: string): string; static stringToObject(str: string): { [id: string]: any; }; /** * Order the CSSProperties by applying a map to it * @param obj CSS Properties object * @param map map with the css properties in sequence to render * @returns obj, if no Map is provided, it will return the same object */ static applyMapToObj(obj: any, map?: any): any; } export {};