@tolki/path 1.0.1 → 1.0.3

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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './path';
2
- export * from './pluck';
1
+ export * from './path.js';
2
+ export * from './pluck.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
package/dist/path.d.ts CHANGED
@@ -157,6 +157,7 @@ export declare function setImmutable<TValue>(data: ArrayItems<TValue> | unknown,
157
157
  * Push an item into an array using "dot" notation, walking lists, plain objects and Maps and replacing anything else
158
158
  * along the path, as Arr::set does.
159
159
  *
160
+ * @sideEffects mutates - Pushes onto the given array and writes missing containers into it.
160
161
  * @param data - The array to push values into.
161
162
  * @param key - The path where to push values (number, string, null, or undefined).
162
163
  * @param values - The values to push.
@@ -348,6 +349,7 @@ export declare function getMixedValue<TValue, TDefault = null>(data: ArrayItems<
348
349
  * Set a value in an array using mixed array/object dot notation (mutable version).
349
350
  * Supports both numeric array indices and object property names in paths.
350
351
  *
352
+ * @sideEffects mutates - Writes into the given array and the containers along the path.
351
353
  * @param The root array to modify.
352
354
  * @param key - The path where to set the value.
353
355
  * @param value - The value to set.
@@ -363,6 +365,7 @@ export declare function setMixed<TValue>(arr: TValue[], key: PathKey, value: unk
363
365
  * Push values to an array at the specified mixed path.
364
366
  * Supports both numeric array indices and object property names in paths.
365
367
  *
368
+ * @sideEffects mutates - Pushes onto the given array and the containers along the path.
366
369
  * @param data - The data to push values into.
367
370
  * @param key - The path where to push (supports mixed array/object paths).
368
371
  * @param values - The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;;;;;;GAQG;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,SAAS,WAAW,GAAG,WAAW,EACzE,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,EACzB,GAAG,EAAE,OAAO,GAAG,IAAI,EACnB,KAAK,EAAE,OAAO,GACf,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAmEtB;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,SAAS,WAAW,GAAG,WAAW,EACvE,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,OAAO,EACnC,GAAG,EAAE,OAAO,GACb,OAAO,CAoBT"}
package/dist/path.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { InvalidArgumentException as e, arrayKeyExistsError as t, arrayValueMessage as n, castableToArray as r, defineKey as i, deleteMapKey as a, isArray as o, isFloat as s, isFunction as c, isIllegalOffset as l, isInteger as u, isIntegerLikeKey as d, isMap as f, isNull as p, isNumber as m, isObject as h, isObjectAny as g, isPlainObject as _, isPrototypeObject as v, isString as y, isUndefined as b, isUnsafeKey as x, keyedEntries as S, nextIntegerKey as C, phpArrayKey as w, readMapKey as T, toPhpKeyString as ee, writeMapKey as E } from "@tolki/utils";
2
2
  // src/path.ts
3
+ /* @__NO_SIDE_EFFECTS__ */
3
4
  function D(e) {
4
5
  if (p(e) || b(e)) return [];
5
6
  if (!m(e) && Number.isNaN(e)) return null;
@@ -14,10 +15,11 @@ function D(e) {
14
15
  }
15
16
  return r;
16
17
  }
18
+ /* @__NO_SIDE_EFFECTS__ */
17
19
  function O(e, t) {
18
20
  if (p(t)) return !1;
19
21
  if (m(t)) return o(e) ? u(t) && t >= 0 && t < e.length : !p(e) && h(e) && $(e, String(t)).found;
20
- let n = D(t);
22
+ let n = /* @__PURE__ */ D(t);
21
23
  if (!n || n.length === 0) return !1;
22
24
  let r = e;
23
25
  for (let e of n) if (o(r)) {
@@ -31,6 +33,7 @@ function O(e, t) {
31
33
  else return !1;
32
34
  return !0;
33
35
  }
36
+ /* @__NO_SIDE_EFFECTS__ */
34
37
  function k(e, t) {
35
38
  if (p(t) || b(t)) return {
36
39
  found: !0,
@@ -40,7 +43,7 @@ function k(e, t) {
40
43
  found: !0,
41
44
  value: e[t]
42
45
  } : !p(e) && h(e) ? $(e, String(t)) : { found: !1 };
43
- let n = D(t);
46
+ let n = /* @__PURE__ */ D(t);
44
47
  if (!n || n.length === 0) return { found: !1 };
45
48
  let r = e;
46
49
  for (let e of n) if (o(r)) {
@@ -57,10 +60,12 @@ function k(e, t) {
57
60
  value: r
58
61
  };
59
62
  }
63
+ /* @__NO_SIDE_EFFECTS__ */
60
64
  function A(e, n) {
61
65
  if ((o(n) ? n : [n]).some(l)) throw t();
62
- return h(e) ? j(e, n) : M(e, n);
66
+ return h(e) ? /* @__PURE__ */ j(e, n) : /* @__PURE__ */ M(e, n);
63
67
  }
68
+ /* @__NO_SIDE_EFFECTS__ */
64
69
  function j(e, t) {
65
70
  let n = p(t) || b(t) ? [] : o(t) ? t : [t], r = { ...e }, i = (e, t) => {
66
71
  let n = w(e);
@@ -112,6 +117,7 @@ function j(e, t) {
112
117
  }
113
118
  return r;
114
119
  }
120
+ /* @__NO_SIDE_EFFECTS__ */
115
121
  function M(e, t) {
116
122
  let n = e.slice();
117
123
  if (p(t)) return n;
@@ -148,6 +154,7 @@ function M(e, t) {
148
154
  }
149
155
  return n;
150
156
  }
157
+ /* @__NO_SIDE_EFFECTS__ */
151
158
  function N(e, t, n) {
152
159
  if (p(t)) return n;
153
160
  if (!o(e)) return [];
@@ -190,7 +197,7 @@ function N(e, t, n) {
190
197
  function P(t, r, ...a) {
191
198
  let s = o(t) && !v(t) ? t : [];
192
199
  if (p(r) || b(r)) return s.push(...a), s;
193
- let c = D(r);
200
+ let c = /* @__PURE__ */ D(r);
194
201
  if (!c || c.length === 0) return s;
195
202
  let l = (e, t) => {
196
203
  if (o(e)) {
@@ -244,9 +251,11 @@ function P(t, r, ...a) {
244
251
  }
245
252
  throw new e(n(g, r));
246
253
  }
254
+ /* @__NO_SIDE_EFFECTS__ */
247
255
  function F(e, t = "", n = Infinity) {
248
- return h(e) ? I(e, t, n) : o(e) ? L(e, t, n) : L(p(e) ? [] : [e], t, n);
256
+ return h(e) ? /* @__PURE__ */ I(e, t, n) : o(e) ? /* @__PURE__ */ L(e, t, n) : /* @__PURE__ */ L(p(e) ? [] : [e], t, n);
249
257
  }
258
+ /* @__NO_SIDE_EFFECTS__ */
250
259
  function I(e, t = "", n = Infinity) {
251
260
  if (!h(e)) return {};
252
261
  let r = {}, a = (e, t, s) => {
@@ -257,69 +266,84 @@ function I(e, t = "", n = Infinity) {
257
266
  };
258
267
  return a(e, t, 0), r;
259
268
  }
269
+ /* @__NO_SIDE_EFFECTS__ */
260
270
  function L(e, t = "", n = Infinity) {
261
271
  if (!o(e)) return {};
262
272
  let r = e, a = {}, s = (e, t, r) => {
263
273
  for (let c = 0; c < e.length; c++) {
264
274
  let l = e[c], u = `${t}${c}`;
265
275
  if (r < n && o(l) && l.length > 0) s(l, `${u}.`, r + 1);
266
- else if (r < n && (_(l) && Object.keys(l).length > 0 || f(l) && S(l).length > 0)) for (let [e, t] of Object.entries(I(l, `${u}.`, n - r - 1))) i(a, e, t);
276
+ else if (r < n && (_(l) && Object.keys(l).length > 0 || f(l) && S(l).length > 0)) for (let [e, t] of Object.entries(/* @__PURE__ */ I(l, `${u}.`, n - r - 1))) i(a, e, t);
267
277
  else i(a, u, l);
268
278
  }
269
279
  };
270
280
  return s(r, t, 0), a;
271
281
  }
282
+ /* @__NO_SIDE_EFFECTS__ */
272
283
  function R(e) {
273
- return h(e) ? B(e) : U(e);
284
+ return h(e) ? /* @__PURE__ */ V(e) : /* @__PURE__ */ W(e);
274
285
  }
275
- function z(e, t) {
276
- let n = [...t].sort((e, t) => t.split(".").length - e.split(".").length);
277
- for (let t of n) {
278
- let n = t.split("."), r = n[n.length - 1], a = n.slice(0, -1), o = a.length === 0 ? e : W(e, a.join("."));
279
- if (!h(o)) continue;
280
- let s = o[r];
286
+ function z(e, t, n) {
287
+ let r = /* @__PURE__ */ G(e, t);
288
+ if (!(o(r) || f(r) || _(r)) || n.has(r)) return r;
289
+ let a = o(r) ? r.slice() : f(r) ? new Map(r) : { ...r };
290
+ return f(e) ? E(e, t, a) : i(e, t, a), n.add(a), a;
291
+ }
292
+ function B(e, t) {
293
+ let n = new WeakSet([e]), r = [...t].sort((e, t) => t.split(".").length - e.split(".").length);
294
+ for (let t of r) {
295
+ let r = t.split("."), a = r[r.length - 1], o = e;
296
+ for (let e of r.slice(0, -1)) if (o = z(o, e, n), !n.has(o)) break;
297
+ if (!h(o) || !n.has(o)) continue;
298
+ let s = o[a];
281
299
  if (!h(s)) continue;
282
300
  let c = Object.keys(s);
283
- c.length > 0 && c.every((e, t) => e === String(t)) && i(o, r, c.map((e) => s[e]));
301
+ c.length > 0 && c.every((e, t) => e === String(t)) && i(o, a, c.map((e) => s[e]));
284
302
  }
285
303
  }
286
- function B(e) {
304
+ /* @__NO_SIDE_EFFECTS__ */
305
+ function V(e) {
287
306
  let t = {}, n = /* @__PURE__ */ new Set();
288
307
  for (let [r, a] of S(e)) {
289
- let e = Z(t, r, a);
308
+ let e = /* @__PURE__ */ Z(t, r, a);
290
309
  for (let [n, r] of Object.entries(e)) i(t, n, r);
291
310
  let o = r.split(".");
292
311
  for (let e = 1; e < o.length; e++) n.add(o.slice(0, e).join("."));
293
312
  }
294
- return z(t, n), t;
295
- }
296
- var V = 2 ** 24 - 2;
297
- function H(e) {
298
- return d(e) && Number(e) <= V;
313
+ return B(t, n), t;
299
314
  }
315
+ var H = 2 ** 24 - 2;
316
+ /* @__NO_SIDE_EFFECTS__ */
300
317
  function U(e) {
301
- let t = [];
302
- for (let [n, r] of S(e ?? {})) {
303
- if (n.length === 0) continue;
304
- let e = n.split(".");
305
- if (e.some((e) => !H(e))) continue;
306
- let i = t;
318
+ return d(e) && Number(e) <= H;
319
+ }
320
+ /* @__NO_SIDE_EFFECTS__ */
321
+ function W(e) {
322
+ let t = [], n = new WeakSet([t]);
323
+ for (let [r, i] of S(e ?? {})) {
324
+ if (r.length === 0) continue;
325
+ let e = r.split(".");
326
+ if (e.some((e) => !/* @__PURE__ */ U(e))) continue;
327
+ let a = t;
307
328
  for (let t = 0; t < e.length; t++) {
308
- let n = Number(e[t]);
309
- if (t === e.length - 1) i[n] = r;
329
+ let r = Number(e[t]);
330
+ if (t === e.length - 1) a[r] = i;
310
331
  else {
311
- let e = i[n];
332
+ let e = a[r];
312
333
  if (p(e) || b(e)) {
313
334
  let e = [];
314
- i[n] = e, i = e;
315
- } else if (o(e)) i = e;
316
- else break;
335
+ a[r] = e, n.add(e), a = e;
336
+ } else if (o(e)) {
337
+ let t = n.has(e) ? e : e.slice();
338
+ a[r] = t, n.add(t), a = t;
339
+ } else break;
317
340
  }
318
341
  }
319
342
  }
320
343
  return t;
321
344
  }
322
- function W(e, t) {
345
+ /* @__NO_SIDE_EFFECTS__ */
346
+ function G(e, t) {
323
347
  if (p(e) || b(e) || !g(e)) return;
324
348
  let n = String(t).split("."), r = e;
325
349
  for (let e of n) {
@@ -339,12 +363,13 @@ function W(e, t) {
339
363
  }
340
364
  return r;
341
365
  }
342
- function G(e, t, n = null) {
366
+ /* @__NO_SIDE_EFFECTS__ */
367
+ function K(e, t, n = null) {
343
368
  let i = () => c(n) ? n() : n;
344
369
  if (p(t)) return e;
345
370
  if (m(t)) {
346
371
  if (!o(e)) return i();
347
- let { found: n, value: a } = k(r(e), t);
372
+ let { found: n, value: a } = /* @__PURE__ */ k(r(e), t);
348
373
  return n ? a : i();
349
374
  }
350
375
  let a = String(t);
@@ -353,16 +378,16 @@ function G(e, t, n = null) {
353
378
  return m(t) && t >= 0;
354
379
  })) {
355
380
  if (!o(e)) return i();
356
- let { found: n, value: a } = k(r(e), t);
381
+ let { found: n, value: a } = /* @__PURE__ */ k(r(e), t);
357
382
  return n ? a : i();
358
383
  }
359
- let s = W(e, a);
384
+ let s = /* @__PURE__ */ G(e, a);
360
385
  return b(s) ? i() : s;
361
386
  }
362
- function K(e) {
387
+ function q(e) {
363
388
  return o(e) || _(e) || f(e);
364
389
  }
365
- function q(e, t, n) {
390
+ function J(e, t, n) {
366
391
  if (v(e)) return e;
367
392
  if (p(t) || b(t)) return e.length = 0, o(n) ? e.push(...n) : e.push(n), e;
368
393
  if (m(t)) {
@@ -379,13 +404,13 @@ function q(e, t, n) {
379
404
  if (m(n) && n >= 0 && o(a)) {
380
405
  for (; a.length <= n;) a.push(void 0);
381
406
  let e = a[n];
382
- K(e) || (a[n] = m(s) ? [] : {}), a = a[n];
407
+ q(e) || (a[n] = m(s) ? [] : {}), a = a[n];
383
408
  } else if (f(a)) {
384
409
  let e = String(n), t = T(a, e).value;
385
- K(t) || (t = m(s) ? [] : {}, E(a, e, t)), a = t;
410
+ q(t) || (t = m(s) ? [] : {}, E(a, e, t)), a = t;
386
411
  } else {
387
412
  let e = a, t = String(n), r = x(t), c = r && !Object.hasOwn(e, t) ? void 0 : e[t];
388
- K(c) ? r && i(e, t, o(c) ? [...c] : f(c) ? new Map(c) : { ...c }) : i(e, t, m(s) ? [] : {}), a = e[t];
413
+ q(c) ? r && i(e, t, o(c) ? [...c] : f(c) ? new Map(c) : { ...c }) : i(e, t, m(s) ? [] : {}), a = e[t];
389
414
  }
390
415
  if (v(a)) return e;
391
416
  }
@@ -396,12 +421,12 @@ function q(e, t, n) {
396
421
  } else f(a) ? E(a, String(c), n) : !p(a) && g(a) && i(a, String(c), n);
397
422
  return e;
398
423
  }
399
- function J(e, t, ...n) {
424
+ function Y(e, t, ...n) {
400
425
  if (v(e)) return e;
401
426
  if (p(t) || b(t)) return o(e) ? (e.push(...n), e) : [...n];
402
427
  if (!o(e)) {
403
428
  let e = [];
404
- return q(e, t, n.length === 1 ? n[0] : n), e;
429
+ return J(e, t, n.length === 1 ? n[0] : n), e;
405
430
  }
406
431
  let r = t.toString().split(".");
407
432
  if (r.length === 1) {
@@ -423,7 +448,8 @@ function J(e, t, ...n) {
423
448
  }
424
449
  return o(a) && a.push(...n), e;
425
450
  }
426
- function Y(e, t, n) {
451
+ /* @__NO_SIDE_EFFECTS__ */
452
+ function X(e, t, n) {
427
453
  if (p(t) || b(t)) return n;
428
454
  if (!o(e)) return [];
429
455
  let r = (e) => {
@@ -435,9 +461,10 @@ function Y(e, t, n) {
435
461
  for (let [n, a] of Object.entries(e)) i(t, n, r(a));
436
462
  return t;
437
463
  };
438
- return q(r(e), t, n);
464
+ return J(r(e), t, n);
439
465
  }
440
- function X(e, t) {
466
+ /* @__NO_SIDE_EFFECTS__ */
467
+ function te(e, t) {
441
468
  if (p(t) || b(t)) return p(e) || b(e) ? !1 : o(e) ? e.length > 0 : !h(e) || Object.keys(e).length > 0;
442
469
  if (m(t)) return o(e) ? t >= 0 && t < e.length : h(e) && $(e, String(t)).found;
443
470
  if (!o(e) && !h(e)) return !1;
@@ -446,19 +473,20 @@ function X(e, t) {
446
473
  if ($(e, n).found) return !0;
447
474
  if (!n.includes(".")) return !1;
448
475
  }
449
- let r = W(e, n);
450
- return !b(r);
476
+ return !b(/* @__PURE__ */ G(e, n));
451
477
  }
452
- function te(e, t, n = null) {
478
+ /* @__NO_SIDE_EFFECTS__ */
479
+ function ne(e, t, n = null) {
453
480
  let r = () => c(n) ? n() : n;
454
481
  if (p(t)) return e;
455
482
  if (!h(e)) return r();
456
483
  let i = String(t), a = $(e, i);
457
484
  if (a.found) return b(a.value) ? r() : a.value;
458
485
  if (!i.includes(".")) return r();
459
- let o = W(e, i);
486
+ let o = /* @__PURE__ */ G(e, i);
460
487
  return b(o) ? r() : o;
461
488
  }
489
+ /* @__NO_SIDE_EFFECTS__ */
462
490
  function Z(e, t, n) {
463
491
  if (p(t)) return n;
464
492
  h(e) || (e = {});
@@ -470,18 +498,16 @@ function Z(e, t, n) {
470
498
  f(c) ? E(c, t, n) : i(c, t, n);
471
499
  break;
472
500
  }
473
- let r = f(c) ? T(c, t).value : x(t) && !Object.hasOwn(c, t) ? void 0 : c[t], a = K(r) ? o(r) ? [...r] : f(r) ? new Map(r) : { ...r } : {};
501
+ let r = f(c) ? T(c, t).value : x(t) && !Object.hasOwn(c, t) ? void 0 : c[t], a = q(r) ? o(r) ? [...r] : f(r) ? new Map(r) : { ...r } : {};
474
502
  f(c) ? E(c, t, a) : i(c, t, a), c = a;
475
503
  }
476
504
  return r;
477
505
  }
478
- function ne(e, t) {
506
+ /* @__NO_SIDE_EFFECTS__ */
507
+ function re(e, t) {
479
508
  if (!h(e) || p(t)) return !1;
480
509
  let n = String(t);
481
- if ($(e, n).found) return !0;
482
- if (!n.includes(".")) return !1;
483
- let r = W(e, n);
484
- return !b(r);
510
+ return $(e, n).found ? !0 : n.includes(".") ? !b(/* @__PURE__ */ G(e, n)) : !1;
485
511
  }
486
512
  function Q(e) {
487
513
  return p(e) || b(e) || s(e) ? ee(e) : String(e);
@@ -492,4 +518,4 @@ function $(e, t) {
492
518
  value: e[t]
493
519
  } : { found: !1 };
494
520
  }
495
- export { V as MAX_UNDOT_INDEX, F as dotFlatten, L as dotFlattenArray, I as dotFlattenObject, A as forgetKeys, M as forgetKeysArray, j as forgetKeysObject, G as getMixedValue, W as getNestedValue, te as getObjectValue, k as getRaw, X as hasMixed, ne as hasObjectKey, O as hasPath, H as isCanonicalUndotIndex, D as parseSegments, J as pushMixed, P as pushWithPath, N as setImmutable, q as setMixed, Y as setMixedImmutable, Z as setObjectValue, R as undotExpand, U as undotExpandArray, B as undotExpandObject };
521
+ export { H as MAX_UNDOT_INDEX, F as dotFlatten, L as dotFlattenArray, I as dotFlattenObject, A as forgetKeys, M as forgetKeysArray, j as forgetKeysObject, K as getMixedValue, G as getNestedValue, ne as getObjectValue, k as getRaw, te as hasMixed, re as hasObjectKey, O as hasPath, U as isCanonicalUndotIndex, D as parseSegments, Y as pushMixed, P as pushWithPath, N as setImmutable, J as setMixed, X as setMixedImmutable, Z as setObjectValue, R as undotExpand, W as undotExpandArray, V as undotExpandObject };
@@ -1 +1 @@
1
- {"version":3,"file":"pluck.d.ts","sourceRoot":"","sources":["../src/pluck.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EACA,OAAO,EAAE,GACT,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAC5B,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GACpC,OAAO,EAAE,CAWX;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CA2BT;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAgBT;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,GAChB,CAAC,OAAO,EAAE,OAAO,CAAC,CAIpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,GACxC,MAAM,EAAE,CAUV;AA0CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IACpD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC,CAOA;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,GAAG,IAAI,OAAO,CAAA;CAAE,CAExE"}
1
+ {"version":3,"file":"pluck.d.ts","sourceRoot":"","sources":["../src/pluck.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AAEH,wBAAgB,sBAAsB,CAClC,MAAM,EACA,OAAO,EAAE,GACT,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAC5B,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GACpC,OAAO,EAAE,CAWX;AAED;;;;;;GAMG;AAEH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CA2BT;AAED;;;;;;GAMG;AAEH,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAgBT;AAED;;;;;;GAMG;AAEH,wBAAgB,YAAY,CACxB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,GAChB,CAAC,OAAO,EAAE,OAAO,CAAC,CAIpB;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,GACxC,MAAM,EAAE,CAUV;AA0CD;;;;;GAKG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IACpD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC,CAOA;AAED;;;;;GAKG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,GAAG,IAAI,OAAO,CAAA;CAAE,CAExE"}
package/dist/pluck.js CHANGED
@@ -1,29 +1,34 @@
1
1
  import { isArray as e, isFunction as t, isMap as n, isNull as r, isNumber as i, isObject as a, isPhpFalsy as o, isPlainObject as s, isUndefined as c, keyedEntries as l, phpArrayKey as u, readMapKey as d } from "@tolki/utils";
2
2
  // src/pluck.ts
3
- var f = Symbol("absent");
3
+ var f = /* @__PURE__ */ Symbol("absent");
4
+ /* @__NO_SIDE_EFFECTS__ */
4
5
  function p(t) {
5
6
  return e(t) ? t : n(t) ? l(t).map(([, e]) => e) : Object.values(t);
6
7
  }
8
+ /* @__NO_SIDE_EFFECTS__ */
7
9
  function m(t, n) {
8
10
  if (n.length === 0) return t;
9
11
  let [r, ...i] = n;
10
12
  if (r === "*") {
11
- let n = b(t) ? t.all() : t;
12
- return !e(n) && !a(n) ? null : p(n).map((e) => m(e, i));
13
+ let n = /* @__PURE__ */ b(t) ? t.all() : t;
14
+ return !e(n) && !a(n) ? null : (/* @__PURE__ */ p(n)).map((e) => /* @__PURE__ */ m(e, i));
13
15
  }
14
16
  let o = v(t, r);
15
- return o === f || c(o) ? null : m(o, i);
17
+ return o === f || c(o) ? null : /* @__PURE__ */ m(o, i);
16
18
  }
19
+ /* @__NO_SIDE_EFFECTS__ */
17
20
  function h(e, t) {
18
21
  if (t.length === 0) return !1;
19
22
  let n = e;
20
23
  for (let e of t) if (n = v(n, e), n === f) return !1;
21
24
  return !0;
22
25
  }
26
+ /* @__NO_SIDE_EFFECTS__ */
23
27
  function g(e, t) {
24
28
  let n = v(e, t);
25
29
  return n === f ? [!1, void 0] : [!0, n];
26
30
  }
31
+ /* @__NO_SIDE_EFFECTS__ */
27
32
  function _(t) {
28
33
  return r(t) ? [] : e(t) ? [...t] : String(t).split(".");
29
34
  }
@@ -37,11 +42,13 @@ function v(t, r) {
37
42
  let e = d(t, r);
38
43
  return e.found ? e.value : f;
39
44
  }
40
- return y(t) ? (b(t) ? v(t.all(), r) !== f : !o(t.offsetExists(r))) ? t.offsetGet(r) : f : Object.hasOwn(t, r) ? t[r] : f;
45
+ return /* @__PURE__ */ y(t) ? (/* @__PURE__ */ b(t) ? v(t.all(), r) !== f : !o(t.offsetExists(r))) ? t.offsetGet(r) : f : Object.hasOwn(t, r) ? t[r] : f;
41
46
  }
47
+ /* @__NO_SIDE_EFFECTS__ */
42
48
  function y(e) {
43
49
  return a(e) && !s(e) && t(e.offsetExists) && t(e.offsetGet);
44
50
  }
51
+ /* @__NO_SIDE_EFFECTS__ */
45
52
  function b(e) {
46
53
  return a(e) && !s(e) && t(e.all);
47
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/path",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Utilities for working with path-based operations across arrays/objects.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -22,8 +22,8 @@
22
22
  "dot-notation"
23
23
  ],
24
24
  "dependencies": {
25
- "@tolki/utils": "^1.6.3",
26
- "@tolki/types": "^1.11.0"
25
+ "@tolki/utils": "^1.7.0",
26
+ "@tolki/types": "^1.13.0"
27
27
  },
28
28
  "sideEffects": false,
29
29
  "files": [
@@ -35,18 +35,15 @@
35
35
  "types": "dist/index.d.ts",
36
36
  "exports": {
37
37
  ".": {
38
- "import": "./dist/index.js",
39
- "require": "./dist/index.js",
40
- "types": "./dist/index.d.ts"
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
41
40
  },
42
41
  "./path": {
43
42
  "types": "./dist/path.d.ts",
44
- "import": "./dist/path.js",
45
43
  "default": "./dist/path.js"
46
44
  },
47
45
  "./pluck": {
48
46
  "types": "./dist/pluck.d.ts",
49
- "import": "./dist/pluck.js",
50
47
  "default": "./dist/pluck.js"
51
48
  }
52
49
  }