UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

13 lines (12 loc) 386 B
/** * Checks if a string is a valid JSON format. * * @param str - The string to check. * @returns A boolean indicating whether the string is valid JSON. * * @example * isJSON('{"name": "John", "age": 30}'); // Output: true * isJSON('{name: John, age: 30}'); // Output: false * isJSON('random string'); // Output: false */ export default function isJSON(str: string): boolean;