@visulima/object 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,269 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const isObject = /* @__PURE__ */ __name((value) => {
4
+ const type = typeof value;
5
+ return value !== null && (type === "object" || type === "function");
6
+ }, "isObject");
7
+ const isEmptyObject = /* @__PURE__ */ __name((value) => isObject(value) && Object.keys(value).length === 0, "isEmptyObject");
8
+ const disallowedKeys = /* @__PURE__ */ new Set([
9
+ "__proto__",
10
+ "prototype",
11
+ "constructor"
12
+ ]);
13
+ const digits = new Set("0123456789");
14
+ function getPathSegments(path) {
15
+ const parts = [];
16
+ let currentSegment = "";
17
+ let currentPart = "start";
18
+ let isIgnoring = false;
19
+ for (const character of path) {
20
+ switch (character) {
21
+ case "\\": {
22
+ if (currentPart === "index") {
23
+ throw new Error("Invalid character in an index");
24
+ }
25
+ if (currentPart === "indexEnd") {
26
+ throw new Error("Invalid character after an index");
27
+ }
28
+ if (isIgnoring) {
29
+ currentSegment += character;
30
+ }
31
+ currentPart = "property";
32
+ isIgnoring = !isIgnoring;
33
+ break;
34
+ }
35
+ case ".": {
36
+ if (currentPart === "index") {
37
+ throw new Error("Invalid character in an index");
38
+ }
39
+ if (currentPart === "indexEnd") {
40
+ currentPart = "property";
41
+ break;
42
+ }
43
+ if (isIgnoring) {
44
+ isIgnoring = false;
45
+ currentSegment += character;
46
+ break;
47
+ }
48
+ if (disallowedKeys.has(currentSegment)) {
49
+ return [];
50
+ }
51
+ parts.push(currentSegment);
52
+ currentSegment = "";
53
+ currentPart = "property";
54
+ break;
55
+ }
56
+ case "[": {
57
+ if (currentPart === "index") {
58
+ throw new Error("Invalid character in an index");
59
+ }
60
+ if (currentPart === "indexEnd") {
61
+ currentPart = "index";
62
+ break;
63
+ }
64
+ if (isIgnoring) {
65
+ isIgnoring = false;
66
+ currentSegment += character;
67
+ break;
68
+ }
69
+ if (currentPart === "property") {
70
+ if (disallowedKeys.has(currentSegment)) {
71
+ return [];
72
+ }
73
+ parts.push(currentSegment);
74
+ currentSegment = "";
75
+ }
76
+ currentPart = "index";
77
+ break;
78
+ }
79
+ case "]": {
80
+ if (currentPart === "index") {
81
+ parts.push(Number.parseInt(currentSegment, 10));
82
+ currentSegment = "";
83
+ currentPart = "indexEnd";
84
+ break;
85
+ }
86
+ if (currentPart === "indexEnd") {
87
+ throw new Error("Invalid character after an index");
88
+ }
89
+ }
90
+ default: {
91
+ if (currentPart === "index" && !digits.has(character)) {
92
+ throw new Error("Invalid character in an index");
93
+ }
94
+ if (currentPart === "indexEnd") {
95
+ throw new Error("Invalid character after an index");
96
+ }
97
+ if (currentPart === "start") {
98
+ currentPart = "property";
99
+ }
100
+ if (isIgnoring) {
101
+ isIgnoring = false;
102
+ currentSegment += "\\";
103
+ }
104
+ currentSegment += character;
105
+ }
106
+ }
107
+ }
108
+ if (isIgnoring) {
109
+ currentSegment += "\\";
110
+ }
111
+ switch (currentPart) {
112
+ case "property": {
113
+ if (disallowedKeys.has(currentSegment)) {
114
+ return [];
115
+ }
116
+ parts.push(currentSegment);
117
+ break;
118
+ }
119
+ case "index": {
120
+ throw new Error("Index was not closed");
121
+ }
122
+ case "start": {
123
+ parts.push("");
124
+ break;
125
+ }
126
+ }
127
+ return parts;
128
+ }
129
+ __name(getPathSegments, "getPathSegments");
130
+ function isStringIndex(object, key) {
131
+ if (typeof key !== "number" && Array.isArray(object)) {
132
+ const index = Number.parseInt(key, 10);
133
+ return Number.isInteger(index) && object[index] === object[key];
134
+ }
135
+ return false;
136
+ }
137
+ __name(isStringIndex, "isStringIndex");
138
+ function assertNotStringIndex(object, key) {
139
+ if (isStringIndex(object, key)) {
140
+ throw new Error("Cannot use string index");
141
+ }
142
+ }
143
+ __name(assertNotStringIndex, "assertNotStringIndex");
144
+ function getProperty(object, path, value) {
145
+ if (!isObject(object) || typeof path !== "string") {
146
+ return value === undefined ? object : value;
147
+ }
148
+ const pathArray = getPathSegments(path);
149
+ if (pathArray.length === 0) {
150
+ return value;
151
+ }
152
+ for (let index = 0; index < pathArray.length; index++) {
153
+ const key = pathArray[index];
154
+ if (isStringIndex(object, key)) {
155
+ object = index === pathArray.length - 1 ? undefined : null;
156
+ } else {
157
+ object = object[key];
158
+ }
159
+ if (object === undefined || object === null) {
160
+ if (index !== pathArray.length - 1) {
161
+ return value;
162
+ }
163
+ break;
164
+ }
165
+ }
166
+ return object === undefined ? value : object;
167
+ }
168
+ __name(getProperty, "getProperty");
169
+ function setProperty(object, path, value) {
170
+ if (!isObject(object) || typeof path !== "string") {
171
+ return object;
172
+ }
173
+ const root = object;
174
+ const pathArray = getPathSegments(path);
175
+ for (let index = 0; index < pathArray.length; index++) {
176
+ const key = pathArray[index];
177
+ assertNotStringIndex(object, key);
178
+ if (index === pathArray.length - 1) {
179
+ object[key] = value;
180
+ } else if (!isObject(object[key])) {
181
+ object[key] = typeof pathArray[index + 1] === "number" ? [] : {};
182
+ }
183
+ object = object[key];
184
+ }
185
+ return root;
186
+ }
187
+ __name(setProperty, "setProperty");
188
+ function deleteProperty(object, path) {
189
+ if (!isObject(object) || typeof path !== "string") {
190
+ return false;
191
+ }
192
+ const pathArray = getPathSegments(path);
193
+ for (let index = 0; index < pathArray.length; index++) {
194
+ const key = pathArray[index];
195
+ assertNotStringIndex(object, key);
196
+ if (index === pathArray.length - 1) {
197
+ delete object[key];
198
+ return true;
199
+ }
200
+ object = object[key];
201
+ if (!isObject(object)) {
202
+ return false;
203
+ }
204
+ }
205
+ }
206
+ __name(deleteProperty, "deleteProperty");
207
+ function hasProperty(object, path) {
208
+ if (!isObject(object) || typeof path !== "string") {
209
+ return false;
210
+ }
211
+ const pathArray = getPathSegments(path);
212
+ if (pathArray.length === 0) {
213
+ return false;
214
+ }
215
+ for (const key of pathArray) {
216
+ if (!isObject(object) || !(key in object) || isStringIndex(object, key)) {
217
+ return false;
218
+ }
219
+ object = object[key];
220
+ }
221
+ return true;
222
+ }
223
+ __name(hasProperty, "hasProperty");
224
+ function escapePath(path) {
225
+ if (typeof path !== "string") {
226
+ throw new TypeError("Expected a string");
227
+ }
228
+ return path.replaceAll(/[\\.[]/g, "\\$&");
229
+ }
230
+ __name(escapePath, "escapePath");
231
+ function entries(value) {
232
+ const result = Object.entries(value);
233
+ if (Array.isArray(value)) {
234
+ return result.map(([key, value2]) => [Number(key), value2]);
235
+ }
236
+ return result;
237
+ }
238
+ __name(entries, "entries");
239
+ function stringifyPath(pathSegments) {
240
+ let result = "";
241
+ for (let [index, segment] of entries(pathSegments)) {
242
+ if (typeof segment === "number") {
243
+ result += `[${segment}]`;
244
+ } else {
245
+ segment = escapePath(segment);
246
+ result += index === 0 ? segment : `.${segment}`;
247
+ }
248
+ }
249
+ return result;
250
+ }
251
+ __name(stringifyPath, "stringifyPath");
252
+ function* deepKeysIterator(object, currentPath = []) {
253
+ if (!isObject(object) || isEmptyObject(object)) {
254
+ if (currentPath.length > 0) {
255
+ yield stringifyPath(currentPath);
256
+ }
257
+ return;
258
+ }
259
+ for (const [key, value] of entries(object)) {
260
+ yield* deepKeysIterator(value, [...currentPath, key]);
261
+ }
262
+ }
263
+ __name(deepKeysIterator, "deepKeysIterator");
264
+ function deepKeys(object) {
265
+ return [...deepKeysIterator(object)];
266
+ }
267
+ __name(deepKeys, "deepKeys");
268
+
269
+ export { deepKeys, deleteProperty, escapePath, getProperty, hasProperty, setProperty };
@@ -0,0 +1,12 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function isPlainObject(value) {
4
+ if (typeof value !== "object" || value === null) {
5
+ return false;
6
+ }
7
+ const prototype = Object.getPrototypeOf(value);
8
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
9
+ }
10
+ __name(isPlainObject, "isPlainObject");
11
+
12
+ export { isPlainObject as default };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function isPlainObject(value) {
6
+ if (typeof value !== "object" || value === null) {
7
+ return false;
8
+ }
9
+ const prototype = Object.getPrototypeOf(value);
10
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
11
+ }
12
+ __name(isPlainObject, "isPlainObject");
13
+
14
+ module.exports = isPlainObject;
@@ -0,0 +1,38 @@
1
+ import isPlainObject from './isPlainObject-BEp1xndO.mjs';
2
+ import { p as pathsAreEqual } from './paths-are-equal-DY1QWTwZ.mjs';
3
+
4
+ var __defProp$1 = Object.defineProperty;
5
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
6
+ const recursiveOmit = /* @__PURE__ */ __name$1((object, omittedKeys, pathUntilNow = "") => {
7
+ if (!isPlainObject(object)) {
8
+ return object;
9
+ }
10
+ return Object.entries(object).reduce((carry, [key, value]) => {
11
+ let path = pathUntilNow;
12
+ if (path) {
13
+ path += ".";
14
+ }
15
+ path += key;
16
+ if (omittedKeys.some((guardPath) => pathsAreEqual(path, guardPath))) {
17
+ return carry;
18
+ }
19
+ if (!isPlainObject(value)) {
20
+ carry[key] = value;
21
+ return carry;
22
+ }
23
+ carry[key] = recursiveOmit(object[key], omittedKeys, path);
24
+ return carry;
25
+ }, {});
26
+ }, "recursiveOmit");
27
+
28
+ var __defProp = Object.defineProperty;
29
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
30
+ const isFullArray = /* @__PURE__ */ __name((input) => Array.isArray(input) && input.length > 0, "isFullArray");
31
+ const omit = /* @__PURE__ */ __name((object, keys) => {
32
+ if (!isFullArray(keys)) {
33
+ return object;
34
+ }
35
+ return recursiveOmit(object, keys);
36
+ }, "omit");
37
+
38
+ export { omit as default };
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ const isPlainObject = require('./isPlainObject-D2hOGcuW.cjs');
4
+ const pathsAreEqual = require('./paths-are-equal-BvHTDEDJ.cjs');
5
+
6
+ var __defProp$1 = Object.defineProperty;
7
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
8
+ const recursiveOmit = /* @__PURE__ */ __name$1((object, omittedKeys, pathUntilNow = "") => {
9
+ if (!isPlainObject(object)) {
10
+ return object;
11
+ }
12
+ return Object.entries(object).reduce((carry, [key, value]) => {
13
+ let path = pathUntilNow;
14
+ if (path) {
15
+ path += ".";
16
+ }
17
+ path += key;
18
+ if (omittedKeys.some((guardPath) => pathsAreEqual.pathsAreEqual(path, guardPath))) {
19
+ return carry;
20
+ }
21
+ if (!isPlainObject(value)) {
22
+ carry[key] = value;
23
+ return carry;
24
+ }
25
+ carry[key] = recursiveOmit(object[key], omittedKeys, path);
26
+ return carry;
27
+ }, {});
28
+ }, "recursiveOmit");
29
+
30
+ var __defProp = Object.defineProperty;
31
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
32
+ const isFullArray = /* @__PURE__ */ __name((input) => Array.isArray(input) && input.length > 0, "isFullArray");
33
+ const omit = /* @__PURE__ */ __name((object, keys) => {
34
+ if (!isFullArray(keys)) {
35
+ return object;
36
+ }
37
+ return recursiveOmit(object, keys);
38
+ }, "omit");
39
+
40
+ module.exports = omit;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ const pathsAreEqual = /* @__PURE__ */ __name((path, wildcardPath) => {
6
+ const wildcardPathPieces = wildcardPath.split(".");
7
+ const pathWithWildcards = path.split(".").reduce((carry, piece, index) => {
8
+ const add = wildcardPathPieces[index] === "*" ? "*" : piece;
9
+ carry.push(add);
10
+ return carry;
11
+ }, []).join(".");
12
+ return pathWithWildcards === wildcardPath;
13
+ }, "pathsAreEqual");
14
+
15
+ exports.pathsAreEqual = pathsAreEqual;
@@ -0,0 +1,13 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const pathsAreEqual = /* @__PURE__ */ __name((path, wildcardPath) => {
4
+ const wildcardPathPieces = wildcardPath.split(".");
5
+ const pathWithWildcards = path.split(".").reduce((carry, piece, index) => {
6
+ const add = wildcardPathPieces[index] === "*" ? "*" : piece;
7
+ carry.push(add);
8
+ return carry;
9
+ }, []).join(".");
10
+ return pathWithWildcards === wildcardPath;
11
+ }, "pathsAreEqual");
12
+
13
+ export { pathsAreEqual as p };
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ const isPlainObject = require('./isPlainObject-D2hOGcuW.cjs');
4
+ const pathsAreEqual = require('./paths-are-equal-BvHTDEDJ.cjs');
5
+
6
+ var __defProp$1 = Object.defineProperty;
7
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
8
+ const recursivePick = /* @__PURE__ */ __name$1((object, pickedKeys, pathUntilNow = "") => {
9
+ if (!isPlainObject(object)) {
10
+ return object;
11
+ }
12
+ return Object.entries(object).reduce((carry, [key, value]) => {
13
+ let path = pathUntilNow;
14
+ if (path) {
15
+ path += ".";
16
+ }
17
+ path += key;
18
+ if (pickedKeys.length > 0) {
19
+ let passed = false;
20
+ pickedKeys.forEach((pickedKey) => {
21
+ const pathDepth = path.split(".").length;
22
+ const pickedKeyDepth = pickedKey.split(".").length;
23
+ const pickedKeyUpToNow = pickedKey.split(".").slice(0, pathDepth).join(".");
24
+ const pathUpToPickedKeyDepth = path.split(".").slice(0, pickedKeyDepth).join(".");
25
+ if (pathsAreEqual.pathsAreEqual(pathUpToPickedKeyDepth, pickedKeyUpToNow)) {
26
+ passed = true;
27
+ }
28
+ });
29
+ if (!passed) {
30
+ return carry;
31
+ }
32
+ }
33
+ if (!isPlainObject(value)) {
34
+ carry[key] = value;
35
+ return carry;
36
+ }
37
+ carry[key] = recursivePick(object[key], pickedKeys, path);
38
+ return carry;
39
+ }, {});
40
+ }, "recursivePick");
41
+
42
+ var __defProp = Object.defineProperty;
43
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
44
+ const isFullArray = /* @__PURE__ */ __name((input) => Array.isArray(input) && input.length > 0, "isFullArray");
45
+ const pick = /* @__PURE__ */ __name((object, keys) => {
46
+ if (!isFullArray(keys)) {
47
+ return {};
48
+ }
49
+ return recursivePick(object, keys);
50
+ }, "pick");
51
+
52
+ module.exports = pick;
@@ -0,0 +1,50 @@
1
+ import isPlainObject from './isPlainObject-BEp1xndO.mjs';
2
+ import { p as pathsAreEqual } from './paths-are-equal-DY1QWTwZ.mjs';
3
+
4
+ var __defProp$1 = Object.defineProperty;
5
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
6
+ const recursivePick = /* @__PURE__ */ __name$1((object, pickedKeys, pathUntilNow = "") => {
7
+ if (!isPlainObject(object)) {
8
+ return object;
9
+ }
10
+ return Object.entries(object).reduce((carry, [key, value]) => {
11
+ let path = pathUntilNow;
12
+ if (path) {
13
+ path += ".";
14
+ }
15
+ path += key;
16
+ if (pickedKeys.length > 0) {
17
+ let passed = false;
18
+ pickedKeys.forEach((pickedKey) => {
19
+ const pathDepth = path.split(".").length;
20
+ const pickedKeyDepth = pickedKey.split(".").length;
21
+ const pickedKeyUpToNow = pickedKey.split(".").slice(0, pathDepth).join(".");
22
+ const pathUpToPickedKeyDepth = path.split(".").slice(0, pickedKeyDepth).join(".");
23
+ if (pathsAreEqual(pathUpToPickedKeyDepth, pickedKeyUpToNow)) {
24
+ passed = true;
25
+ }
26
+ });
27
+ if (!passed) {
28
+ return carry;
29
+ }
30
+ }
31
+ if (!isPlainObject(value)) {
32
+ carry[key] = value;
33
+ return carry;
34
+ }
35
+ carry[key] = recursivePick(object[key], pickedKeys, path);
36
+ return carry;
37
+ }, {});
38
+ }, "recursivePick");
39
+
40
+ var __defProp = Object.defineProperty;
41
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
42
+ const isFullArray = /* @__PURE__ */ __name((input) => Array.isArray(input) && input.length > 0, "isFullArray");
43
+ const pick = /* @__PURE__ */ __name((object, keys) => {
44
+ if (!isFullArray(keys)) {
45
+ return {};
46
+ }
47
+ return recursivePick(object, keys);
48
+ }, "pick");
49
+
50
+ export { pick as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/object",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Helper functions for working with objects and arrays.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -79,22 +79,22 @@
79
79
  "devDependencies": {
80
80
  "@anolilab/eslint-config": "^15.0.3",
81
81
  "@anolilab/prettier-config": "^5.0.14",
82
- "@anolilab/semantic-release-pnpm": "1.1.3",
83
- "@anolilab/semantic-release-preset": "^9.0.2",
84
- "@arethetypeswrong/cli": "^0.17.1",
82
+ "@anolilab/semantic-release-pnpm": "1.1.6",
83
+ "@anolilab/semantic-release-preset": "^9.0.3",
84
+ "@arethetypeswrong/cli": "^0.17.2",
85
85
  "@babel/core": "^7.26.0",
86
86
  "@rushstack/eslint-plugin-security": "^0.8.3",
87
87
  "@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
88
88
  "@total-typescript/ts-reset": "^0.6.1",
89
89
  "@types/node": "18.19.39",
90
- "@visulima/packem": "^1.9.2",
90
+ "@visulima/packem": "^1.10.7",
91
91
  "@vitest/coverage-v8": "^2.1.8",
92
92
  "@vitest/ui": "^2.1.8",
93
93
  "conventional-changelog-conventionalcommits": "8.0.0",
94
94
  "cross-env": "^7.0.3",
95
95
  "deeks": "^3.1.1",
96
96
  "dot-prop": "^9.0.0",
97
- "esbuild": "0.24.0",
97
+ "esbuild": "0.24.2",
98
98
  "eslint": "8.57.0",
99
99
  "eslint-plugin-deprecation": "^3.0.0",
100
100
  "eslint-plugin-etc": "^2.0.3",
@@ -105,11 +105,11 @@
105
105
  "filter-obj": "^6.1.0",
106
106
  "is-plain-obj": "^4.1.0",
107
107
  "prettier": "^3.4.2",
108
- "rimraf": "5.0.9",
109
- "secretlint": "8.2.4",
110
- "semantic-release": "^24.2.0",
111
- "type-fest": "^4.30.0",
112
- "typescript": "5.5.4",
108
+ "rimraf": "6.0.1",
109
+ "secretlint": "9.0.0",
110
+ "semantic-release": "^24.2.1",
111
+ "type-fest": "^4.32.0",
112
+ "typescript": "5.7.3",
113
113
  "vitest": "^2.1.8"
114
114
  },
115
115
  "engines": {
@@ -1 +0,0 @@
1
- "use strict";var I=Object.defineProperty;var a=(e,r)=>I(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var k=Object.defineProperty,s=a((e,r)=>k(e,"name",{value:r,configurable:!0}),"s");const f=s(e=>{const r=typeof e;return e!==null&&(r==="object"||r==="function")},"isObject"),m=s(e=>f(e)&&Object.keys(e).length===0,"isEmptyObject"),p=new Set(["__proto__","prototype","constructor"]),j=new Set("0123456789");function u(e){const r=[];let n="",t="start",i=!1;for(const o of e)switch(o){case"\\":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");i&&(n+=o),t="property",i=!i;break}case".":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="property";break}if(i){i=!1,n+=o;break}if(p.has(n))return[];r.push(n),n="",t="property";break}case"[":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="index";break}if(i){i=!1,n+=o;break}if(t==="property"){if(p.has(n))return[];r.push(n),n=""}t="index";break}case"]":{if(t==="index"){r.push(Number.parseInt(n,10)),n="",t="indexEnd";break}if(t==="indexEnd")throw new Error("Invalid character after an index")}default:{if(t==="index"&&!j.has(o))throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");t==="start"&&(t="property"),i&&(i=!1,n+="\\"),n+=o}}switch(i&&(n+="\\"),t){case"property":{if(p.has(n))return[];r.push(n);break}case"index":throw new Error("Index was not closed");case"start":{r.push("");break}}return r}a(u,"d");s(u,"getPathSegments");function d(e,r){if(typeof r!="number"&&Array.isArray(e)){const n=Number.parseInt(r,10);return Number.isInteger(n)&&e[n]===e[r]}return!1}a(d,"l");s(d,"isStringIndex");function h(e,r){if(d(e,r))throw new Error("Cannot use string index")}a(h,"p");s(h,"assertNotStringIndex");function b(e,r,n){if(!f(e)||typeof r!="string")return n===void 0?e:n;const t=u(r);if(t.length===0)return n;for(let i=0;i<t.length;i++){const o=t[i];if(d(e,o)?e=i===t.length-1?void 0:null:e=e[o],e==null){if(i!==t.length-1)return n;break}}return e===void 0?n:e}a(b,"getProperty");s(b,"getProperty");function x(e,r,n){if(!f(e)||typeof r!="string")return e;const t=e,i=u(r);for(let o=0;o<i.length;o++){const c=i[o];h(e,c),o===i.length-1?e[c]=n:f(e[c])||(e[c]=typeof i[o+1]=="number"?[]:{}),e=e[c]}return t}a(x,"setProperty");s(x,"setProperty");function w(e,r){if(!f(e)||typeof r!="string")return!1;const n=u(r);for(let t=0;t<n.length;t++){const i=n[t];if(h(e,i),t===n.length-1)return delete e[i],!0;if(e=e[i],!f(e))return!1}}a(w,"deleteProperty");s(w,"deleteProperty");function P(e,r){if(!f(e)||typeof r!="string")return!1;const n=u(r);if(n.length===0)return!1;for(const t of n){if(!f(e)||!(t in e)||d(e,t))return!1;e=e[t]}return!0}a(P,"hasProperty");s(P,"hasProperty");function l(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}a(l,"escapePath");s(l,"escapePath");function y(e){const r=Object.entries(e);return Array.isArray(e)?r.map(([n,t])=>[Number(n),t]):r}a(y,"h");s(y,"entries");function E(e){let r="";for(let[n,t]of y(e))typeof t=="number"?r+=`[${t}]`:(t=l(t),r+=n===0?t:`.${t}`);return r}a(E,"w");s(E,"stringifyPath");function*g(e,r=[]){if(!f(e)||m(e)){r.length>0&&(yield E(r));return}for(const[n,t]of y(e))yield*g(t,[...r,n])}a(g,"y");s(g,"deepKeysIterator");function v(e){return[...g(e)]}a(v,"deepKeys");s(v,"deepKeys");exports.deepKeys=v;exports.deleteProperty=w;exports.escapePath=l;exports.getProperty=b;exports.hasProperty=P;exports.setProperty=x;
@@ -1 +0,0 @@
1
- var w=Object.defineProperty;var a=(e,r)=>w(e,"name",{value:r,configurable:!0});var b=Object.defineProperty,f=a((e,r)=>b(e,"name",{value:r,configurable:!0}),"s");const s=f(e=>{const r=typeof e;return e!==null&&(r==="object"||r==="function")},"isObject"),E=f(e=>s(e)&&Object.keys(e).length===0,"isEmptyObject"),p=new Set(["__proto__","prototype","constructor"]),I=new Set("0123456789");function u(e){const r=[];let n="",t="start",i=!1;for(const o of e)switch(o){case"\\":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");i&&(n+=o),t="property",i=!i;break}case".":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="property";break}if(i){i=!1,n+=o;break}if(p.has(n))return[];r.push(n),n="",t="property";break}case"[":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="index";break}if(i){i=!1,n+=o;break}if(t==="property"){if(p.has(n))return[];r.push(n),n=""}t="index";break}case"]":{if(t==="index"){r.push(Number.parseInt(n,10)),n="",t="indexEnd";break}if(t==="indexEnd")throw new Error("Invalid character after an index")}default:{if(t==="index"&&!I.has(o))throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");t==="start"&&(t="property"),i&&(i=!1,n+="\\"),n+=o}}switch(i&&(n+="\\"),t){case"property":{if(p.has(n))return[];r.push(n);break}case"index":throw new Error("Index was not closed");case"start":{r.push("");break}}return r}a(u,"d");f(u,"getPathSegments");function d(e,r){if(typeof r!="number"&&Array.isArray(e)){const n=Number.parseInt(r,10);return Number.isInteger(n)&&e[n]===e[r]}return!1}a(d,"l");f(d,"isStringIndex");function h(e,r){if(d(e,r))throw new Error("Cannot use string index")}a(h,"p");f(h,"assertNotStringIndex");function v(e,r,n){if(!s(e)||typeof r!="string")return n===void 0?e:n;const t=u(r);if(t.length===0)return n;for(let i=0;i<t.length;i++){const o=t[i];if(d(e,o)?e=i===t.length-1?void 0:null:e=e[o],e==null){if(i!==t.length-1)return n;break}}return e===void 0?n:e}a(v,"getProperty");f(v,"getProperty");function P(e,r,n){if(!s(e)||typeof r!="string")return e;const t=e,i=u(r);for(let o=0;o<i.length;o++){const c=i[o];h(e,c),o===i.length-1?e[c]=n:s(e[c])||(e[c]=typeof i[o+1]=="number"?[]:{}),e=e[c]}return t}a(P,"setProperty");f(P,"setProperty");function k(e,r){if(!s(e)||typeof r!="string")return!1;const n=u(r);for(let t=0;t<n.length;t++){const i=n[t];if(h(e,i),t===n.length-1)return delete e[i],!0;if(e=e[i],!s(e))return!1}}a(k,"deleteProperty");f(k,"deleteProperty");function m(e,r){if(!s(e)||typeof r!="string")return!1;const n=u(r);if(n.length===0)return!1;for(const t of n){if(!s(e)||!(t in e)||d(e,t))return!1;e=e[t]}return!0}a(m,"hasProperty");f(m,"hasProperty");function g(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}a(g,"escapePath");f(g,"escapePath");function l(e){const r=Object.entries(e);return Array.isArray(e)?r.map(([n,t])=>[Number(n),t]):r}a(l,"h");f(l,"entries");function x(e){let r="";for(let[n,t]of l(e))typeof t=="number"?r+=`[${t}]`:(t=g(t),r+=n===0?t:`.${t}`);return r}a(x,"w");f(x,"stringifyPath");function*y(e,r=[]){if(!s(e)||E(e)){r.length>0&&(yield x(r));return}for(const[n,t]of l(e))yield*y(t,[...r,n])}a(y,"y");f(y,"deepKeysIterator");function j(e){return[...y(e)]}a(j,"deepKeys");f(j,"deepKeys");export{j as deepKeys,k as deleteProperty,g as escapePath,v as getProperty,m as hasProperty,P as setProperty};
@@ -1 +0,0 @@
1
- var r=Object.defineProperty;var o=(e,t)=>r(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,l=o((e,t)=>n(e,"name",{value:t,configurable:!0}),"e");function a(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}o(a,"r");l(a,"isPlainObject");export{a as default};
@@ -1 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var o=(e,t)=>n(e,"name",{value:t,configurable:!0});var i=Object.defineProperty,l=o((e,t)=>i(e,"name",{value:t,configurable:!0}),"e");function r(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}o(r,"r");l(r,"isPlainObject");module.exports=r;
@@ -1 +0,0 @@
1
- "use strict";var v=Object.defineProperty;var t=(r,e)=>v(r,"name",{value:e,configurable:!0});const u=require("./isPlainObject-Ct8-08mJ.cjs"),b=require("./paths-are-equal-D8teV-Y-.cjs");var f=Object.defineProperty,y=t((r,e)=>f(r,"name",{value:e,configurable:!0}),"m$1");const s=y((r,e,o="")=>u(r)?Object.entries(r).reduce((a,[n,c])=>{let i=o;return i&&(i+="."),i+=n,e.some(m=>b.c(i,m))?a:u(c)?(a[n]=s(r[n],e,i),a):(a[n]=c,a)},{}):r,"recursiveOmit");var O=Object.defineProperty,l=t((r,e)=>O(r,"name",{value:e,configurable:!0}),"r");const j=l(r=>Array.isArray(r)&&r.length>0,"isFullArray"),p=l((r,e)=>j(e)?s(r,e):r,"omit");module.exports=p;
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var n=(r,e)=>v(r,"name",{value:e,configurable:!0});import m from"./isPlainObject-CLTs8VdF.mjs";import{c as s}from"./paths-are-equal-BgwMgI_D.mjs";var b=Object.defineProperty,p=n((r,e)=>b(r,"name",{value:e,configurable:!0}),"m$1");const c=p((r,e,u="")=>m(r)?Object.entries(r).reduce((a,[i,t])=>{let o=u;return o&&(o+="."),o+=i,e.some(f=>s(o,f))?a:m(t)?(a[i]=c(r[i],e,o),a):(a[i]=t,a)},{}):r,"recursiveOmit");var y=Object.defineProperty,l=n((r,e)=>y(r,"name",{value:e,configurable:!0}),"r");const d=l(r=>Array.isArray(r)&&r.length>0,"isFullArray"),A=l((r,e)=>d(e)?c(r,e):r,"omit");export{A as default};
@@ -1 +0,0 @@
1
- var u=Object.defineProperty;var t=(r,e)=>u(r,"name",{value:e,configurable:!0});var p=Object.defineProperty,l=t((r,e)=>p(r,"name",{value:e,configurable:!0}),"n");const d=l((r,e)=>{const o=e.split(".");return r.split(".").reduce((n,a,c)=>{const s=o[c]==="*"?"*":a;return n.push(s),n},[]).join(".")===e},"pathsAreEqual");export{d as c};
@@ -1 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var n=(r,e)=>o(r,"name",{value:e,configurable:!0});var i=Object.defineProperty,l=n((r,e)=>i(r,"name",{value:e,configurable:!0}),"n");const p=l((r,e)=>{const c=e.split(".");return r.split(".").reduce((t,s,u)=>{const a=c[u]==="*"?"*":s;return t.push(a),t},[]).join(".")===e},"pathsAreEqual");exports.c=p;
@@ -1 +0,0 @@
1
- var b=Object.defineProperty;var a=(e,r)=>b(e,"name",{value:r,configurable:!0});import s from"./isPlainObject-CLTs8VdF.mjs";import{c as d}from"./paths-are-equal-BgwMgI_D.mjs";var j=Object.defineProperty,y=a((e,r)=>j(e,"name",{value:r,configurable:!0}),"h");const p=y((e,r,f="")=>s(e)?Object.entries(e).reduce((i,[l,c])=>{let t=f;if(t&&(t+="."),t+=l,r.length>0){let n=!1;if(r.forEach(o=>{const v=t.split(".").length,g=o.split(".").length,h=o.split(".").slice(0,v).join("."),m=t.split(".").slice(0,g).join(".");d(m,h)&&(n=!0)}),!n)return i}return s(c)?(i[l]=p(e[l],r,t),i):(i[l]=c,i)},{}):e,"recursivePick");var P=Object.defineProperty,u=a((e,r)=>P(e,"name",{value:r,configurable:!0}),"t");const A=u(e=>Array.isArray(e)&&e.length>0,"isFullArray"),E=u((e,r)=>A(r)?p(e,r):{},"pick");export{E as default};
@@ -1 +0,0 @@
1
- "use strict";var j=Object.defineProperty;var l=(e,r)=>j(e,"name",{value:r,configurable:!0});const u=require("./isPlainObject-Ct8-08mJ.cjs"),y=require("./paths-are-equal-D8teV-Y-.cjs");var P=Object.defineProperty,d=l((e,r)=>P(e,"name",{value:r,configurable:!0}),"h");const o=d((e,r,f="")=>u(e)?Object.entries(e).reduce((i,[c,a])=>{let t=f;if(t&&(t+="."),t+=c,r.length>0){let n=!1;if(r.forEach(s=>{const h=t.split(".").length,v=s.split(".").length,b=s.split(".").slice(0,h).join("."),g=t.split(".").slice(0,v).join(".");y.c(g,b)&&(n=!0)}),!n)return i}return u(a)?(i[c]=o(e[c],r,t),i):(i[c]=a,i)},{}):e,"recursivePick");var A=Object.defineProperty,p=l((e,r)=>A(e,"name",{value:r,configurable:!0}),"t");const O=p(e=>Array.isArray(e)&&e.length>0,"isFullArray"),q=p((e,r)=>O(r)?o(e,r):{},"pick");module.exports=q;