rollun-ts-utils
Version:
Simple JavaScript utils
22 lines (21 loc) • 643 B
TypeScript
/**
* function tests is given string a valid JSON, or not
* Examples:
* isJSON('') -> false
* isJSON(null) -> false
* isJSON('{}') -> true
* isJSON('{"1": invalid json') -> false
*/
export declare function isJSON(str: string): boolean;
export declare function isJSONObject(str: string): boolean;
export declare function isInt(val: string | number): boolean;
/**
* strict check if string is valid float
* Example:
* isFloat('1.2') -> true
* isFloat('1') -> true
* isFloat('1,2') -> true
* isFloat('1.2b') -> false
* isFloat('1.2 ') -> false
*/
export declare function isFloat(val: string): boolean;