seitu
Version:
15 lines • 377 B
text/typescript
//#region src/utils/json/index.d.ts
/**
* Parses JSON; returns the input when it is not a string or is invalid JSON.
*
* @example
* ```ts twoslash
* import { tryParseJson } from 'seitu/utils'
*
* tryParseJson('{"a":1}') // { a: 1 }
* tryParseJson('oops') // 'oops'
* ```
*/
declare function tryParseJson(value: unknown): unknown;
//#endregion
export { tryParseJson };