UNPKG

react-box-tools

Version:

Box tools react components, utils and hooks

23 lines (22 loc) 657 B
const s = (e) => { if (e === null || typeof e != "object") return e; if (Array.isArray(e)) return e.map((r) => s(r)); const n = {}; for (const r in e) e.hasOwnProperty(r) && (n[r] = s(e[r])); return n; }, f = (e) => { const n = (r) => { Object.keys(r).forEach((t) => { Array.isArray(r[t]) ? r[t] = [] : r[t] !== null && typeof r[t] == "object" ? n(r[t]) : typeof r[t] == "string" ? r[t] = "" : typeof r[t] == "number" ? r[t] = 0 : typeof r[t] == "boolean" ? r[t] = !1 : r[t] = null; }); }; return n(e), e; }, l = (e, n) => e && typeof e == "object" && n in e ? e[n] : null; export { f as a, s as d, l as g };