UNPKG

altair-graphql-core

Version:

Several of the core logic for altair graphql client

14 lines 431 B
import JSONBigint from 'json-bigint'; /** * Parses a JSON string into an object. Has support for BigInt and falls back to a default value if parsing fails. */ export const parseJson = (str, { defaultValue = {} } = {}) => { try { return JSONBigint.parse(str); } catch { console.warn('Could not parse JSON. Using default instead.'); return defaultValue; } }; //# sourceMappingURL=json.js.map