UNPKG

safers

Version:

Safely convert to the desired data and error-free refine values.

15 lines (14 loc) 306 B
import { isObject as i } from "../utils/isObject.js"; import { isString as n } from "../utils/isString.js"; import "../../lib/identifyType-d39b7385.js"; function s(r, t = {}) { const e = i(t) ? t : {}; try { return n(r) ? JSON.parse(r) : e; } catch { return e; } } export { s as parse };