"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { assignAfter: () => assignAfter, compact: () => compact, omit: () => omit, pick: () => pick, split: () => split, walkObject: () => walkObject }); module.exports = __toCommonJS(src_exports); // src/assign-after.ts function assignAfter(target, ...sources) { if (target == null) { throw new TypeError("Cannot convert undefined or null to object"); } const result = { ...target }; for (const nextSource of sources) { if (nextSource == null) continue; for (const nextKey in nextSource) { if (!Object.prototype.hasOwnProperty.call(nextSource, nextKey)) continue; if (nextKey in result) delete result[nextKey]; result[nextKey] = nextSource[nextKey]; } } return result; } // src/compact.ts function compact(object) { const clone = Object.assign({}, object); for (let key in clone) { if (clone[key] === void 0) delete clone[key]; } return clone; } // src/omit.ts function omit(object, keysToOmit = []) { const clone = Object.assign({}, object); for (const key of keysToOmit) { if (key in clone) { delete clone[key]; } } return clone; } // src/pick.ts function pick(object, keysToPick) { const result = {}; for (const key of keysToPick) { if (key in object) { result[key] = object[key]; } } return result; } // src/split.ts function split(object, keys) { const picked = {}; const omitted = {}; for (const [key, value] of Object.entries(object)) { if (keys.includes(key)) picked[key] = value; else omitted[key] = value; } return [picked, omitted]; } // src/walk-object.ts function isObject(value) { return typeof value === "object" && value != null && !Array.isArray(value); } function walkObject(target, predicate, options = {}) { const { stop, getKey } = options; function inner(value, path = []) { var _a; if (isObject(value) || Array.isArray(value)) { const result = {}; for (const [prop, child] of Object.entries(value)) { const key = (_a = getKey == null ? void 0 : getKey(prop)) != null ? _a : prop; const childPath = [...path, key]; if (stop == null ? void 0 : stop(value, childPath)) { return predicate(value, path); } result[key] = inner(child, childPath); } return result; } return predicate(value, path); } return inner(target); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { assignAfter, compact, omit, pick, split, walkObject });