UNPKG

ts-data-objects

Version:

Simple lightweight library for enhancing plain JS objects with TypeScript wrappers enabling easy API data assertion and validation

26 lines (25 loc) 727 B
import { D as _ } from "./dataError-aVfBT4F-.js"; const d = (e) => (r) => typeof r == "object" && r != null && e(r), f = (e) => (r) => e ? { ...e, ...r } : r || {}, l = (e, r, t, n, s) => { if (t(s)) return r(s); { const c = new _(e, s); if (n) return console.error(c), r(s); throw c; } }, u = (e, r, t, n) => (s) => l(e, r, t, n ?? !1, s), D = (e, r) => { const t = f(r == null ? void 0 : r.defaultValues), n = d(r.predicate), s = u(e, t, n, r.doNotThrow), c = { [`${e}`]: t }, o = { [`is${e}`]: n }, a = { [`parse${e}`]: s }; return { ...c, ...o, ...a }; }; export { d as dataGuard, f as dataObject, u as dataParser, D as defineObject }; //# sourceMappingURL=core.js.map