UNPKG

@tempots/std

Version:

Std library for TypeScript. Natural complement to the Tempo libraries.

49 lines (48 loc) 1.34 kB
const o = (e) => Object.keys(e), f = (e) => Object.values(e), l = (e) => Object.entries(e), u = (e) => Object.fromEntries(e), O = (e, t) => { const n = o(e), s = o(t); if (n.length !== s.length) return !1; for (const r of n) if (!(r in t)) return !1; return !0; }, a = (e) => e != null && Object.getPrototypeOf(e) === Object.prototype, p = (e, ...t) => { const n = new Set(t); return o(e).reduce((r, c) => (n.has(c) || (r[c] = e[c]), r), {}); }, y = (e, t) => Object.assign({}, e, t), k = (e) => Object.keys(e).length === 0, m = (e, t) => { const n = {}; for (const s of t) s in e && (n[s] = e[s]); return n; }, g = (e, t) => { const n = { ...e }; for (const s of t) delete n[s]; return n; }, i = (e) => { if (e === null || typeof e != "object") return e; if (e instanceof Date) return new Date(e.getTime()); if (e instanceof Array) return e.map((t) => i(t)); if (typeof e == "object") { const t = {}; for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = i(e[n])); return t; } return e; }; export { i as deepClone, k as isEmptyObject, a as isObject, y as mergeObjects, l as objectEntries, u as objectFromEntries, o as objectKeys, f as objectValues, g as omit, m as pick, p as removeObjectFields, O as sameObjectKeys };