UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

17 lines (16 loc) • 563 B
import { a as asOptionalRecord } from "./record-coerce-CVPuDqcc.mjs"; //#region packages/normalization-core/src/json-coercion.ts /** Parses JSON without throwing, returning undefined for invalid input. */ function safeParseJson(e) { try { return JSON.parse(e); } catch { return; } } /** Parses JSON into a non-array record, returning undefined for every other result. */ function safeParseJsonRecord(e) { return /^[\t\n\r ]*\{/.test(e) ? asOptionalRecord(safeParseJson(e)) : void 0; } //#endregion export { safeParseJsonRecord as n, safeParseJson as t };