@visulima/object 1.0.11 → 2.0.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE.md +1 -130
  3. package/dist/index.d.ts +216 -7
  4. package/dist/index.js +1 -0
  5. package/dist/packem_shared/getProperty-DPNB_aKG.js +1 -0
  6. package/dist/packem_shared/isPlainObject-CLTs8VdF.js +1 -0
  7. package/dist/packem_shared/omit-BfV-sPAM.js +1 -0
  8. package/dist/packem_shared/paths-are-equal-BYur8Hqc.js +1 -0
  9. package/dist/packem_shared/pick-CT4qE7de.js +1 -0
  10. package/package.json +7 -21
  11. package/dist/index.cjs +0 -187
  12. package/dist/index.d.cts +0 -7
  13. package/dist/index.d.mts +0 -7
  14. package/dist/index.mjs +0 -176
  15. package/dist/omit.d.cts +0 -20
  16. package/dist/omit.d.mts +0 -20
  17. package/dist/omit.d.ts +0 -20
  18. package/dist/packem_shared/getProperty-W4y1P_8H.cjs +0 -278
  19. package/dist/packem_shared/getProperty-uiEqCe4m.mjs +0 -269
  20. package/dist/packem_shared/isPlainObject-BEp1xndO.mjs +0 -12
  21. package/dist/packem_shared/isPlainObject-D2hOGcuW.cjs +0 -14
  22. package/dist/packem_shared/omit-Bz46-jv-.mjs +0 -38
  23. package/dist/packem_shared/omit-DSwyUtN2.cjs +0 -40
  24. package/dist/packem_shared/paths-are-equal-BvHTDEDJ.cjs +0 -15
  25. package/dist/packem_shared/paths-are-equal-DY1QWTwZ.mjs +0 -13
  26. package/dist/packem_shared/pick-BX11mP2m.cjs +0 -52
  27. package/dist/packem_shared/pick-C9-E3eDJ.mjs +0 -50
  28. package/dist/pick.d.cts +0 -20
  29. package/dist/pick.d.mts +0 -20
  30. package/dist/pick.d.ts +0 -20
  31. package/dist/utils/paths-are-equal.d.cts +0 -9
  32. package/dist/utils/paths-are-equal.d.mts +0 -9
  33. package/dist/utils/paths-are-equal.d.ts +0 -9
  34. package/dist/utils/recursive-omit.d.cts +0 -3
  35. package/dist/utils/recursive-omit.d.mts +0 -3
  36. package/dist/utils/recursive-omit.d.ts +0 -3
  37. package/dist/utils/recursive-pick.d.cts +0 -3
  38. package/dist/utils/recursive-pick.d.mts +0 -3
  39. package/dist/utils/recursive-pick.d.ts +0 -3
@@ -1,278 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const isObject = /* @__PURE__ */ __name((value) => {
8
- const type = typeof value;
9
- return value !== null && (type === "object" || type === "function");
10
- }, "isObject");
11
- const isEmptyObject = /* @__PURE__ */ __name((value) => isObject(value) && Object.keys(value).length === 0, "isEmptyObject");
12
- const disallowedKeys = /* @__PURE__ */ new Set([
13
- "__proto__",
14
- "prototype",
15
- "constructor"
16
- ]);
17
- const digits = new Set("0123456789");
18
- function getPathSegments(path) {
19
- const parts = [];
20
- let currentSegment = "";
21
- let currentPart = "start";
22
- let isIgnoring = false;
23
- for (const character of path) {
24
- switch (character) {
25
- case "\\": {
26
- if (currentPart === "index") {
27
- throw new Error("Invalid character in an index");
28
- }
29
- if (currentPart === "indexEnd") {
30
- throw new Error("Invalid character after an index");
31
- }
32
- if (isIgnoring) {
33
- currentSegment += character;
34
- }
35
- currentPart = "property";
36
- isIgnoring = !isIgnoring;
37
- break;
38
- }
39
- case ".": {
40
- if (currentPart === "index") {
41
- throw new Error("Invalid character in an index");
42
- }
43
- if (currentPart === "indexEnd") {
44
- currentPart = "property";
45
- break;
46
- }
47
- if (isIgnoring) {
48
- isIgnoring = false;
49
- currentSegment += character;
50
- break;
51
- }
52
- if (disallowedKeys.has(currentSegment)) {
53
- return [];
54
- }
55
- parts.push(currentSegment);
56
- currentSegment = "";
57
- currentPart = "property";
58
- break;
59
- }
60
- case "[": {
61
- if (currentPart === "index") {
62
- throw new Error("Invalid character in an index");
63
- }
64
- if (currentPart === "indexEnd") {
65
- currentPart = "index";
66
- break;
67
- }
68
- if (isIgnoring) {
69
- isIgnoring = false;
70
- currentSegment += character;
71
- break;
72
- }
73
- if (currentPart === "property") {
74
- if (disallowedKeys.has(currentSegment)) {
75
- return [];
76
- }
77
- parts.push(currentSegment);
78
- currentSegment = "";
79
- }
80
- currentPart = "index";
81
- break;
82
- }
83
- case "]": {
84
- if (currentPart === "index") {
85
- parts.push(Number.parseInt(currentSegment, 10));
86
- currentSegment = "";
87
- currentPart = "indexEnd";
88
- break;
89
- }
90
- if (currentPart === "indexEnd") {
91
- throw new Error("Invalid character after an index");
92
- }
93
- }
94
- default: {
95
- if (currentPart === "index" && !digits.has(character)) {
96
- throw new Error("Invalid character in an index");
97
- }
98
- if (currentPart === "indexEnd") {
99
- throw new Error("Invalid character after an index");
100
- }
101
- if (currentPart === "start") {
102
- currentPart = "property";
103
- }
104
- if (isIgnoring) {
105
- isIgnoring = false;
106
- currentSegment += "\\";
107
- }
108
- currentSegment += character;
109
- }
110
- }
111
- }
112
- if (isIgnoring) {
113
- currentSegment += "\\";
114
- }
115
- switch (currentPart) {
116
- case "property": {
117
- if (disallowedKeys.has(currentSegment)) {
118
- return [];
119
- }
120
- parts.push(currentSegment);
121
- break;
122
- }
123
- case "index": {
124
- throw new Error("Index was not closed");
125
- }
126
- case "start": {
127
- parts.push("");
128
- break;
129
- }
130
- }
131
- return parts;
132
- }
133
- __name(getPathSegments, "getPathSegments");
134
- function isStringIndex(object, key) {
135
- if (typeof key !== "number" && Array.isArray(object)) {
136
- const index = Number.parseInt(key, 10);
137
- return Number.isInteger(index) && object[index] === object[key];
138
- }
139
- return false;
140
- }
141
- __name(isStringIndex, "isStringIndex");
142
- function assertNotStringIndex(object, key) {
143
- if (isStringIndex(object, key)) {
144
- throw new Error("Cannot use string index");
145
- }
146
- }
147
- __name(assertNotStringIndex, "assertNotStringIndex");
148
- function getProperty(object, path, value) {
149
- if (!isObject(object) || typeof path !== "string") {
150
- return value === void 0 ? object : value;
151
- }
152
- const pathArray = getPathSegments(path);
153
- if (pathArray.length === 0) {
154
- return value;
155
- }
156
- for (let index = 0; index < pathArray.length; index++) {
157
- const key = pathArray[index];
158
- if (isStringIndex(object, key)) {
159
- object = index === pathArray.length - 1 ? void 0 : null;
160
- } else {
161
- object = object[key];
162
- }
163
- if (object === void 0 || object === null) {
164
- if (index !== pathArray.length - 1) {
165
- return value;
166
- }
167
- break;
168
- }
169
- }
170
- return object === void 0 ? value : object;
171
- }
172
- __name(getProperty, "getProperty");
173
- function setProperty(object, path, value) {
174
- if (!isObject(object) || typeof path !== "string") {
175
- return object;
176
- }
177
- const root = object;
178
- const pathArray = getPathSegments(path);
179
- for (let index = 0; index < pathArray.length; index++) {
180
- const key = pathArray[index];
181
- assertNotStringIndex(object, key);
182
- if (index === pathArray.length - 1) {
183
- object[key] = value;
184
- } else if (!isObject(object[key])) {
185
- object[key] = typeof pathArray[index + 1] === "number" ? [] : {};
186
- }
187
- object = object[key];
188
- }
189
- return root;
190
- }
191
- __name(setProperty, "setProperty");
192
- function deleteProperty(object, path) {
193
- if (!isObject(object) || typeof path !== "string") {
194
- return false;
195
- }
196
- const pathArray = getPathSegments(path);
197
- for (let index = 0; index < pathArray.length; index++) {
198
- const key = pathArray[index];
199
- assertNotStringIndex(object, key);
200
- if (index === pathArray.length - 1) {
201
- delete object[key];
202
- return true;
203
- }
204
- object = object[key];
205
- if (!isObject(object)) {
206
- return false;
207
- }
208
- }
209
- }
210
- __name(deleteProperty, "deleteProperty");
211
- function hasProperty(object, path) {
212
- if (!isObject(object) || typeof path !== "string") {
213
- return false;
214
- }
215
- const pathArray = getPathSegments(path);
216
- if (pathArray.length === 0) {
217
- return false;
218
- }
219
- for (const key of pathArray) {
220
- if (!isObject(object) || !(key in object) || isStringIndex(object, key)) {
221
- return false;
222
- }
223
- object = object[key];
224
- }
225
- return true;
226
- }
227
- __name(hasProperty, "hasProperty");
228
- function escapePath(path) {
229
- if (typeof path !== "string") {
230
- throw new TypeError("Expected a string");
231
- }
232
- return path.replaceAll(/[\\.[]/g, "\\$&");
233
- }
234
- __name(escapePath, "escapePath");
235
- function entries(value) {
236
- const result = Object.entries(value);
237
- if (Array.isArray(value)) {
238
- return result.map(([key, value2]) => [Number(key), value2]);
239
- }
240
- return result;
241
- }
242
- __name(entries, "entries");
243
- function stringifyPath(pathSegments) {
244
- let result = "";
245
- for (let [index, segment] of entries(pathSegments)) {
246
- if (typeof segment === "number") {
247
- result += `[${segment}]`;
248
- } else {
249
- segment = escapePath(segment);
250
- result += index === 0 ? segment : `.${segment}`;
251
- }
252
- }
253
- return result;
254
- }
255
- __name(stringifyPath, "stringifyPath");
256
- function* deepKeysIterator(object, currentPath = []) {
257
- if (!isObject(object) || isEmptyObject(object)) {
258
- if (currentPath.length > 0) {
259
- yield stringifyPath(currentPath);
260
- }
261
- return;
262
- }
263
- for (const [key, value] of entries(object)) {
264
- yield* deepKeysIterator(value, [...currentPath, key]);
265
- }
266
- }
267
- __name(deepKeysIterator, "deepKeysIterator");
268
- function deepKeys(object) {
269
- return [...deepKeysIterator(object)];
270
- }
271
- __name(deepKeys, "deepKeys");
272
-
273
- exports.deepKeys = deepKeys;
274
- exports.deleteProperty = deleteProperty;
275
- exports.escapePath = escapePath;
276
- exports.getProperty = getProperty;
277
- exports.hasProperty = hasProperty;
278
- exports.setProperty = setProperty;
@@ -1,269 +0,0 @@
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 === void 0 ? 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 ? void 0 : null;
156
- } else {
157
- object = object[key];
158
- }
159
- if (object === void 0 || object === null) {
160
- if (index !== pathArray.length - 1) {
161
- return value;
162
- }
163
- break;
164
- }
165
- }
166
- return object === void 0 ? 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 };
@@ -1,12 +0,0 @@
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 };
@@ -1,14 +0,0 @@
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;
@@ -1,38 +0,0 @@
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 };
@@ -1,40 +0,0 @@
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;
@@ -1,15 +0,0 @@
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;
@@ -1,13 +0,0 @@
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 };