es-toolkit 1.13.0-dev.293 → 1.13.0-dev.294

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/browser.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
- src_exports
3
- } from "./chunk-MJ77KX4L.mjs";
2
+ compat_exports
3
+ } from "./chunk-BJWAMCFH.mjs";
4
+ import "./chunk-NKLIE2OI.mjs";
4
5
  import "./chunk-XT74R35S.mjs";
5
6
  import "./chunk-EYYZQFOP.mjs";
6
7
  import "./chunk-5IKVJGHO.mjs";
@@ -38,33 +39,23 @@ import "./chunk-MY4G7R3I.mjs";
38
39
  import "./chunk-5ASRKEB4.mjs";
39
40
  import "./chunk-2SLTL4KL.mjs";
40
41
  import "./chunk-DPH2KE6O.mjs";
41
- import "./chunk-236H5JZJ.mjs";
42
- import "./chunk-3IP4JVLL.mjs";
43
- import "./chunk-BOOQBJN2.mjs";
44
- import "./chunk-LKXCOLNY.mjs";
45
- import "./chunk-CMBC4MXG.mjs";
46
- import "./chunk-QOJGMVVR.mjs";
47
42
  import "./chunk-DDH7K4QM.mjs";
48
- import "./chunk-6GWEY5EL.mjs";
49
- import "./chunk-4KYXHZ4R.mjs";
50
- import "./chunk-UYZKMBDO.mjs";
51
43
  import "./chunk-IFNXROZR.mjs";
52
44
  import "./chunk-PYEYV7BY.mjs";
53
45
  import "./chunk-L7FQX5MN.mjs";
54
46
  import "./chunk-Q47NGNXT.mjs";
55
47
  import "./chunk-QRSJBBFY.mjs";
56
48
  import "./chunk-IDCUZVJL.mjs";
57
- import "./chunk-NTLX2MPV.mjs";
58
- import "./chunk-2IXFGSUA.mjs";
49
+ import "./chunk-6GWEY5EL.mjs";
50
+ import "./chunk-4KYXHZ4R.mjs";
59
51
  import "./chunk-OP4OAKQJ.mjs";
60
52
  import "./chunk-R6QA7PLZ.mjs";
61
53
  import "./chunk-NFS7RWWE.mjs";
62
54
  import "./chunk-2ZCITDMK.mjs";
63
- import "./chunk-237HGSZS.mjs";
64
55
  import "./chunk-DVK2N4KC.mjs";
65
56
  import "./chunk-B4COTK4K.mjs";
66
- import "./chunk-7B7W36UP.mjs";
67
- import "./chunk-DN3NOZ3H.mjs";
57
+ import "./chunk-237HGSZS.mjs";
58
+ import "./chunk-UYZKMBDO.mjs";
68
59
  import "./chunk-2KNLZB7V.mjs";
69
60
  import "./chunk-EHSKB6DF.mjs";
70
61
  import "./chunk-GIWAOOFY.mjs";
@@ -73,36 +64,46 @@ import "./chunk-G7UQ5PUR.mjs";
73
64
  import "./chunk-TJ4Z5I7M.mjs";
74
65
  import "./chunk-ME352XO7.mjs";
75
66
  import "./chunk-IQLKIDXF.mjs";
76
- import "./chunk-XPSOKBRZ.mjs";
77
- import "./chunk-FVVSE2F2.mjs";
67
+ import "./chunk-NTLX2MPV.mjs";
68
+ import "./chunk-2IXFGSUA.mjs";
78
69
  import "./chunk-O6UXZR3U.mjs";
79
70
  import "./chunk-XI7KRD2C.mjs";
80
71
  import "./chunk-AJKZMN2V.mjs";
81
72
  import "./chunk-KPBQ7OUY.mjs";
82
73
  import "./chunk-OOKNBU4V.mjs";
83
74
  import "./chunk-IJD7FE2Z.mjs";
84
- import "./chunk-YFN6KOC4.mjs";
85
- import "./chunk-UY76KTPE.mjs";
75
+ import "./chunk-7B7W36UP.mjs";
76
+ import "./chunk-DN3NOZ3H.mjs";
86
77
  import "./chunk-ML727RRJ.mjs";
87
- import "./chunk-33MSBDC6.mjs";
88
78
  import "./chunk-IEA53J7P.mjs";
89
79
  import "./chunk-E6E4RZLN.mjs";
90
80
  import "./chunk-HM2JT2RX.mjs";
91
- import "./chunk-CRSKT4WW.mjs";
92
- import "./chunk-JPUKH67K.mjs";
81
+ import "./chunk-XPSOKBRZ.mjs";
82
+ import "./chunk-FVVSE2F2.mjs";
93
83
  import "./chunk-LVWX5B43.mjs";
94
84
  import "./chunk-6NVQAHXP.mjs";
95
85
  import "./chunk-3EZAFZG3.mjs";
96
86
  import "./chunk-OXZCMC5I.mjs";
97
87
  import "./chunk-M7SBBYV2.mjs";
98
88
  import "./chunk-LJ2C6MVP.mjs";
89
+ import "./chunk-YFN6KOC4.mjs";
90
+ import "./chunk-UY76KTPE.mjs";
91
+ import "./chunk-33MSBDC6.mjs";
92
+ import "./chunk-E6C5EZQA.mjs";
93
+ import "./chunk-DTJJIMKJ.mjs";
94
+ import "./chunk-CRSKT4WW.mjs";
95
+ import "./chunk-JPUKH67K.mjs";
99
96
  import "./chunk-F47GLYUU.mjs";
100
97
  import "./chunk-DXB7EZUQ.mjs";
101
98
  import "./chunk-KIOYQRMQ.mjs";
102
- import "./chunk-E6C5EZQA.mjs";
103
- import "./chunk-DTJJIMKJ.mjs";
99
+ import "./chunk-236H5JZJ.mjs";
100
+ import "./chunk-BOOQBJN2.mjs";
101
+ import "./chunk-LKXCOLNY.mjs";
102
+ import "./chunk-CMBC4MXG.mjs";
103
+ import "./chunk-QOJGMVVR.mjs";
104
+ import "./chunk-3IP4JVLL.mjs";
104
105
  import "./chunk-24FKGR6U.mjs";
105
106
 
106
107
  // src/browser.ts
107
- window._ = src_exports;
108
+ window._ = compat_exports;
108
109
  //# sourceMappingURL=browser.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/browser.ts"],"sourcesContent":["import * as toolkit from './index';\n\ninterface Window {\n _: typeof toolkit;\n}\n\ndeclare var window: Window;\nwindow._ = toolkit;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,OAAO,IAAI;","names":[]}
1
+ {"version":3,"sources":["../src/browser.ts"],"sourcesContent":["import * as toolkit from './compat/index.ts';\n\ninterface Window {\n _: typeof toolkit;\n}\n\ndeclare var window: Window;\nwindow._ = toolkit;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,OAAO,IAAI;","names":[]}
@@ -55,9 +55,6 @@ import {
55
55
  import {
56
56
  flattenObject
57
57
  } from "./chunk-XGQWTHW6.mjs";
58
- import {
59
- isPlainObject
60
- } from "./chunk-MIGAC7F4.mjs";
61
58
  import {
62
59
  invert
63
60
  } from "./chunk-OLX53VEF.mjs";
@@ -88,30 +85,6 @@ import {
88
85
  import {
89
86
  range
90
87
  } from "./chunk-DPH2KE6O.mjs";
91
- import {
92
- debounce
93
- } from "./chunk-3IP4JVLL.mjs";
94
- import {
95
- negate
96
- } from "./chunk-BOOQBJN2.mjs";
97
- import {
98
- noop
99
- } from "./chunk-LKXCOLNY.mjs";
100
- import {
101
- once
102
- } from "./chunk-CMBC4MXG.mjs";
103
- import {
104
- throttle
105
- } from "./chunk-QOJGMVVR.mjs";
106
- import {
107
- zipObject
108
- } from "./chunk-6GWEY5EL.mjs";
109
- import {
110
- zipWith
111
- } from "./chunk-4KYXHZ4R.mjs";
112
- import {
113
- unzip
114
- } from "./chunk-UYZKMBDO.mjs";
115
88
  import {
116
89
  unzipWith
117
90
  } from "./chunk-IFNXROZR.mjs";
@@ -131,11 +104,11 @@ import {
131
104
  zip
132
105
  } from "./chunk-IDCUZVJL.mjs";
133
106
  import {
134
- takeRightWhile
135
- } from "./chunk-NTLX2MPV.mjs";
107
+ zipObject
108
+ } from "./chunk-6GWEY5EL.mjs";
136
109
  import {
137
- takeWhile
138
- } from "./chunk-2IXFGSUA.mjs";
110
+ zipWith
111
+ } from "./chunk-4KYXHZ4R.mjs";
139
112
  import {
140
113
  toFilled
141
114
  } from "./chunk-OP4OAKQJ.mjs";
@@ -148,9 +121,6 @@ import {
148
121
  import {
149
122
  unionWith
150
123
  } from "./chunk-2ZCITDMK.mjs";
151
- import {
152
- uniqWith
153
- } from "./chunk-237HGSZS.mjs";
154
124
  import {
155
125
  uniq
156
126
  } from "./chunk-DVK2N4KC.mjs";
@@ -158,11 +128,11 @@ import {
158
128
  uniqBy
159
129
  } from "./chunk-B4COTK4K.mjs";
160
130
  import {
161
- orderBy
162
- } from "./chunk-7B7W36UP.mjs";
131
+ uniqWith
132
+ } from "./chunk-237HGSZS.mjs";
163
133
  import {
164
- partition
165
- } from "./chunk-DN3NOZ3H.mjs";
134
+ unzip
135
+ } from "./chunk-UYZKMBDO.mjs";
166
136
  import {
167
137
  sample
168
138
  } from "./chunk-2KNLZB7V.mjs";
@@ -188,11 +158,11 @@ import {
188
158
  takeRight
189
159
  } from "./chunk-IQLKIDXF.mjs";
190
160
  import {
191
- initial
192
- } from "./chunk-XPSOKBRZ.mjs";
161
+ takeRightWhile
162
+ } from "./chunk-NTLX2MPV.mjs";
193
163
  import {
194
- intersection
195
- } from "./chunk-FVVSE2F2.mjs";
164
+ takeWhile
165
+ } from "./chunk-2IXFGSUA.mjs";
196
166
  import {
197
167
  intersectionBy
198
168
  } from "./chunk-O6UXZR3U.mjs";
@@ -212,17 +182,14 @@ import {
212
182
  minBy
213
183
  } from "./chunk-IJD7FE2Z.mjs";
214
184
  import {
215
- fill
216
- } from "./chunk-YFN6KOC4.mjs";
185
+ orderBy
186
+ } from "./chunk-7B7W36UP.mjs";
217
187
  import {
218
- flatMap
219
- } from "./chunk-UY76KTPE.mjs";
188
+ partition
189
+ } from "./chunk-DN3NOZ3H.mjs";
220
190
  import {
221
191
  flattenDeep
222
192
  } from "./chunk-ML727RRJ.mjs";
223
- import {
224
- flatten
225
- } from "./chunk-33MSBDC6.mjs";
226
193
  import {
227
194
  forEachRight
228
195
  } from "./chunk-IEA53J7P.mjs";
@@ -233,11 +200,11 @@ import {
233
200
  head
234
201
  } from "./chunk-HM2JT2RX.mjs";
235
202
  import {
236
- countBy
237
- } from "./chunk-CRSKT4WW.mjs";
203
+ initial
204
+ } from "./chunk-XPSOKBRZ.mjs";
238
205
  import {
239
- difference
240
- } from "./chunk-JPUKH67K.mjs";
206
+ intersection
207
+ } from "./chunk-FVVSE2F2.mjs";
241
208
  import {
242
209
  differenceBy
243
210
  } from "./chunk-LVWX5B43.mjs";
@@ -257,48 +224,82 @@ import {
257
224
  dropWhile
258
225
  } from "./chunk-LJ2C6MVP.mjs";
259
226
  import {
260
- AbortError
261
- } from "./chunk-DXB7EZUQ.mjs";
227
+ fill
228
+ } from "./chunk-YFN6KOC4.mjs";
262
229
  import {
263
- TimeoutError
264
- } from "./chunk-KIOYQRMQ.mjs";
230
+ flatMap
231
+ } from "./chunk-UY76KTPE.mjs";
232
+ import {
233
+ flatten
234
+ } from "./chunk-33MSBDC6.mjs";
265
235
  import {
266
236
  chunk
267
237
  } from "./chunk-E6C5EZQA.mjs";
268
238
  import {
269
239
  compact
270
240
  } from "./chunk-DTJJIMKJ.mjs";
241
+ import {
242
+ countBy
243
+ } from "./chunk-CRSKT4WW.mjs";
244
+ import {
245
+ difference
246
+ } from "./chunk-JPUKH67K.mjs";
247
+ import {
248
+ AbortError
249
+ } from "./chunk-DXB7EZUQ.mjs";
250
+ import {
251
+ TimeoutError
252
+ } from "./chunk-KIOYQRMQ.mjs";
253
+ import {
254
+ negate
255
+ } from "./chunk-BOOQBJN2.mjs";
256
+ import {
257
+ noop
258
+ } from "./chunk-LKXCOLNY.mjs";
259
+ import {
260
+ once
261
+ } from "./chunk-CMBC4MXG.mjs";
262
+ import {
263
+ throttle
264
+ } from "./chunk-QOJGMVVR.mjs";
265
+ import {
266
+ debounce
267
+ } from "./chunk-3IP4JVLL.mjs";
271
268
  import {
272
269
  __export
273
270
  } from "./chunk-24FKGR6U.mjs";
274
271
 
275
- // src/index.ts
276
- var src_exports = {};
277
- __export(src_exports, {
272
+ // src/compat/index.ts
273
+ var compat_exports = {};
274
+ __export(compat_exports, {
278
275
  AbortError: () => AbortError,
279
276
  TimeoutError: () => TimeoutError,
280
277
  camelCase: () => camelCase,
281
278
  capitalize: () => capitalize,
282
- chunk: () => chunk,
279
+ chunk: () => chunk2,
283
280
  clamp: () => clamp,
284
281
  clone: () => clone,
285
282
  compact: () => compact,
283
+ concat: () => concat,
286
284
  countBy: () => countBy,
287
285
  debounce: () => debounce,
288
286
  delay: () => delay,
289
- difference: () => difference,
287
+ difference: () => difference2,
290
288
  differenceBy: () => differenceBy,
291
289
  differenceWith: () => differenceWith,
292
290
  drop: () => drop,
293
291
  dropRight: () => dropRight,
294
292
  dropRightWhile: () => dropRightWhile,
295
293
  dropWhile: () => dropWhile,
294
+ endsWith: () => endsWith,
296
295
  fill: () => fill,
296
+ first: () => head,
297
297
  flatMap: () => flatMap,
298
298
  flatten: () => flatten,
299
299
  flattenDeep: () => flattenDeep,
300
300
  flattenObject: () => flattenObject,
301
301
  forEachRight: () => forEachRight,
302
+ get: () => get,
302
303
  groupBy: () => groupBy,
303
304
  head: () => head,
304
305
  inRange: () => inRange,
@@ -318,9 +319,11 @@ __export(src_exports, {
318
319
  keyBy: () => keyBy,
319
320
  last: () => last,
320
321
  lowerCase: () => lowerCase,
322
+ max: () => max,
321
323
  maxBy: () => maxBy,
322
324
  mean: () => mean,
323
325
  meanBy: () => meanBy,
326
+ min: () => min,
324
327
  minBy: () => minBy,
325
328
  negate: () => negate,
326
329
  noop: () => noop,
@@ -337,9 +340,11 @@ __export(src_exports, {
337
340
  round: () => round,
338
341
  sample: () => sample,
339
342
  sampleSize: () => sampleSize,
343
+ set: () => set,
340
344
  shuffle: () => shuffle,
341
345
  snakeCase: () => snakeCase,
342
346
  startCase: () => startCase,
347
+ startsWith: () => startsWith,
343
348
  sum: () => sum,
344
349
  sumBy: () => sumBy,
345
350
  tail: () => tail,
@@ -364,10 +369,230 @@ __export(src_exports, {
364
369
  xorWith: () => xorWith,
365
370
  zip: () => zip,
366
371
  zipObject: () => zipObject,
372
+ zipObjectDeep: () => zipObjectDeep,
367
373
  zipWith: () => zipWith
368
374
  });
369
375
 
376
+ // src/compat/array/chunk.ts
377
+ function chunk2(arr, size = 1) {
378
+ size = Math.max(Math.floor(size), 0);
379
+ if (size === 0) {
380
+ return [];
381
+ }
382
+ return chunk(arr, size);
383
+ }
384
+
385
+ // src/compat/array/concat.ts
386
+ function concat(...values) {
387
+ return flatten(values);
388
+ }
389
+
390
+ // src/compat/array/difference.ts
391
+ function difference2(arr, ...values) {
392
+ const arr1 = arr;
393
+ const arr2 = flatten(values);
394
+ return difference(arr1, arr2);
395
+ }
396
+
397
+ // src/compat/_internal/isIndex.ts
398
+ var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
399
+ function isIndex(value) {
400
+ switch (typeof value) {
401
+ case "number": {
402
+ return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
403
+ }
404
+ case "symbol": {
405
+ return false;
406
+ }
407
+ case "string": {
408
+ return IS_UNSIGNED_INTEGER.test(value);
409
+ }
410
+ }
411
+ }
412
+
413
+ // src/compat/_internal/toPath.ts
414
+ function toPath(deepKey) {
415
+ const ESCAPE_REGEXP = /\\(\\)?/g;
416
+ const PROPERTY_REGEXP = RegExp(
417
+ // Match anything that isn't a dot or bracket.
418
+ `[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,
419
+ "g"
420
+ );
421
+ const result = [];
422
+ if (deepKey[0] === ".") {
423
+ result.push("");
424
+ }
425
+ let match;
426
+ let lastIndex = 0;
427
+ let count = 0;
428
+ while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {
429
+ let [key, expr, quote, substr] = match;
430
+ if (quote) {
431
+ key = substr.replace(ESCAPE_REGEXP, "$1");
432
+ } else if (expr) {
433
+ key = expr;
434
+ }
435
+ result.push(key);
436
+ if (PROPERTY_REGEXP.lastIndex === lastIndex) {
437
+ PROPERTY_REGEXP.lastIndex++;
438
+ } else {
439
+ lastIndex = PROPERTY_REGEXP.lastIndex;
440
+ }
441
+ }
442
+ return result;
443
+ }
444
+
445
+ // src/compat/object/set.ts
446
+ function set(obj, path, value) {
447
+ const resolvedPath = Array.isArray(path) ? path : typeof path === "string" ? toPath(path) : [path];
448
+ let current = obj;
449
+ for (let i = 0; i < resolvedPath.length - 1; i++) {
450
+ const key = resolvedPath[i];
451
+ const nextKey = resolvedPath[i + 1];
452
+ if (current[key] == null) {
453
+ current[key] = isIndex(nextKey) ? [] : {};
454
+ }
455
+ current = current[key];
456
+ }
457
+ const lastKey = resolvedPath[resolvedPath.length - 1];
458
+ current[lastKey] = value;
459
+ return obj;
460
+ }
461
+
462
+ // src/compat/array/zipObjectDeep.ts
463
+ function zipObjectDeep(keys, values) {
464
+ const result = {};
465
+ const zipped = zip(keys, values);
466
+ for (let i = 0; i < zipped.length; i++) {
467
+ const [key, value] = zipped[i];
468
+ if (key != null) {
469
+ set(result, key, value);
470
+ }
471
+ }
472
+ return result;
473
+ }
474
+
475
+ // src/compat/_internal/isDeepKey.ts
476
+ var IS_PLAIN = /^\w*$/;
477
+ var IS_DEEP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
478
+ function isDeepKey(key) {
479
+ switch (typeof key) {
480
+ case "number":
481
+ case "symbol": {
482
+ return false;
483
+ }
484
+ case "string": {
485
+ return !IS_PLAIN.test(key) && IS_DEEP.test(key);
486
+ }
487
+ }
488
+ }
489
+
490
+ // src/compat/object/get.ts
491
+ function get(object, path, defaultValue) {
492
+ let resolvedPath;
493
+ if (Array.isArray(path)) {
494
+ resolvedPath = path;
495
+ } else if (typeof path === "string" && isDeepKey(path) && (object == null ? void 0 : object[path]) == null) {
496
+ resolvedPath = toPath(path);
497
+ } else {
498
+ resolvedPath = [path];
499
+ }
500
+ if (resolvedPath.length === 0) {
501
+ return defaultValue;
502
+ }
503
+ let current = object;
504
+ let index;
505
+ for (index = 0; index < resolvedPath.length && current != null; index++) {
506
+ let key = resolvedPath[index];
507
+ if (Object.is(key.valueOf(), -0)) {
508
+ key = "-0";
509
+ }
510
+ current = current[key];
511
+ }
512
+ if (current === null && index === resolvedPath.length) {
513
+ return current;
514
+ }
515
+ return current != null ? current : defaultValue;
516
+ }
517
+
518
+ // src/compat/predicate/isPlainObject.ts
519
+ function isPlainObject(object) {
520
+ var _a;
521
+ if (typeof object !== "object") {
522
+ return false;
523
+ }
524
+ if (object == null) {
525
+ return false;
526
+ }
527
+ if (Object.getPrototypeOf(object) === null) {
528
+ return true;
529
+ }
530
+ if (object.toString() !== "[object Object]") {
531
+ const tag = object[Symbol.toStringTag];
532
+ if (tag == null) {
533
+ return false;
534
+ }
535
+ const isTagReadonly = !((_a = Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)) == null ? void 0 : _a.writable);
536
+ if (isTagReadonly) {
537
+ return false;
538
+ }
539
+ return object.toString() === `[object ${tag}]`;
540
+ }
541
+ let proto = object;
542
+ while (Object.getPrototypeOf(proto) !== null) {
543
+ proto = Object.getPrototypeOf(proto);
544
+ }
545
+ return Object.getPrototypeOf(object) === proto;
546
+ }
547
+
548
+ // src/compat/string/startsWith.ts
549
+ var startsWith = (str, target, position = 0) => {
550
+ return str.startsWith(target, position);
551
+ };
552
+
553
+ // src/compat/string/endsWith.ts
554
+ var endsWith = (str, target, position = str.length) => {
555
+ return str.endsWith(target, position);
556
+ };
557
+
558
+ // src/compat/math/max.ts
559
+ function max(items = []) {
560
+ let maxElement = items[0];
561
+ let max2 = void 0;
562
+ for (const element of items) {
563
+ if (max2 == null || element > max2) {
564
+ max2 = element;
565
+ maxElement = element;
566
+ }
567
+ }
568
+ return maxElement;
569
+ }
570
+
571
+ // src/compat/math/min.ts
572
+ function min(items = []) {
573
+ let minElement = items[0];
574
+ let min2 = void 0;
575
+ for (const element of items) {
576
+ if (min2 == null || element < min2) {
577
+ min2 = element;
578
+ minElement = element;
579
+ }
580
+ }
581
+ return minElement;
582
+ }
583
+
370
584
  export {
371
- src_exports
585
+ chunk2 as chunk,
586
+ concat,
587
+ difference2 as difference,
588
+ set,
589
+ zipObjectDeep,
590
+ get,
591
+ isPlainObject,
592
+ startsWith,
593
+ endsWith,
594
+ max,
595
+ min,
596
+ compat_exports
372
597
  };
373
- //# sourceMappingURL=chunk-MJ77KX4L.mjs.map
598
+ //# sourceMappingURL=chunk-BJWAMCFH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/compat/index.ts","../src/compat/array/chunk.ts","../src/compat/array/concat.ts","../src/compat/array/difference.ts","../src/compat/_internal/isIndex.ts","../src/compat/_internal/toPath.ts","../src/compat/object/set.ts","../src/compat/array/zipObjectDeep.ts","../src/compat/_internal/isDeepKey.ts","../src/compat/object/get.ts","../src/compat/predicate/isPlainObject.ts","../src/compat/string/startsWith.ts","../src/compat/string/endsWith.ts","../src/compat/math/max.ts","../src/compat/math/min.ts"],"sourcesContent":["/**\n * es-toolkit compatibility layer with lodash (WIP)\n * ====================================\n * ```tsx\n * // es-toolkit/compat aims to provide 100% feature parity with lodash\n * import { chunk } from 'es-toolkit/compat';\n *\n * chunk([1, 2, 3, 4], 0);\n * // Returns [], which is identical to lodash\n * ```\n *\n * `es-toolkit/compat` will offer complete compatibility with lodash, ensuring a seamless transition.\n *\n * To guarantee identical behavior, `es-toolkit/compat` will be thoroughly tested using actual lodash test cases.\n *\n * The primary goal of `es-toolkit/compat` is to serve as a drop-in replacement for lodash.\n *\n * It's important to note that while `es-toolkit/compat` will mirror the behavior of lodash functions with 100% accuracy,\n * it will deliberately omit unsafe features, such as:\n *\n * - Implicit type casting from an empty string `''` to 0 or false, and similar cases.\n *\n * @module\n */\nexport * from '../index.ts';\n\nexport { chunk } from './array/chunk.ts';\nexport { concat } from './array/concat.ts';\nexport { difference } from './array/difference.ts';\nexport { zipObjectDeep } from './array/zipObjectDeep.ts';\nexport { head as first } from '../index.ts';\n\nexport { get } from './object/get.ts';\nexport { set } from './object/set.ts';\n\nexport { isPlainObject } from './predicate/isPlainObject.ts';\n\nexport { startsWith } from './string/startsWith.ts';\nexport { endsWith } from './string/endsWith.ts';\n\nexport { max } from './math/max.ts';\nexport { min } from './math/min.ts';\n","import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n","import { flatten } from \"../../array/flatten.ts\";\n\n/**\n * Concatenates multiple arrays and values into a single array.\n *\n * @template T The type of elements in the array.\n * @param {...(T | readonly T[])} values - The values and/or arrays to concatenate.\n * @returns {T[]} A new array containing all the input values.\n * \n * @example\n * // Concatenate individual values\n * concat(1, 2, 3); \n * // returns [1, 2, 3]\n *\n * @example\n * // Concatenate arrays of values\n * concat([1, 2], [3, 4]);\n * // returns [1, 2, 3, 4]\n *\n * @example\n * // Concatenate a mix of individual values and arrays\n * concat(1, [2, 3], 4);\n * // returns [1, 2, 3, 4]\n *\n * @example\n * // Concatenate nested arrays\n * concat([1, [2, 3]], 4);\n * // returns [1, [2, 3], 4]\n */\nexport function concat<T>(...values: Array<T | readonly T[]>): T[] {\n return flatten(values) as T[];\n}\n","import { difference as differenceToolkit } from '../../array/difference.ts';\nimport { flatten } from '../../array/flatten.ts';\n\nexport function difference<T>(arr: readonly T[], ...values: Array<readonly T[]>): T[] {\n const arr1 = arr;\n const arr2 = flatten(values);\n\n return differenceToolkit(arr1, arr2);\n}","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}","/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param deepKey - The deep key string to convert.\n * @returns An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\n const PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n \"[^.[\\\\]]+\" +\n \"|\" +\n // Or match property names within brackets.\n \"\\\\[(?:\" +\n // Match a non-string expression.\n \"([^\\\"'][^[]*)\" +\n \"|\" +\n // Or match strings (supports escaping characters).\n \"([\\\"'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2\" +\n \")\\\\]\" +\n \"|\" +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n \"(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))\",\n \"g\",\n );\n\n const result: string[] = [];\n\n if (deepKey[0] === \".\") {\n result.push(\"\");\n }\n\n let match: RegExpExecArray | null;\n let lastIndex = 0;\n let count = 0;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let [key, expr, quote, substr] = match;\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, \"$1\");\n } else if (expr) {\n key = expr;\n }\n\n result.push(key);\n\n if (PROPERTY_REGEXP.lastIndex === lastIndex) {\n PROPERTY_REGEXP.lastIndex++;\n } else {\n lastIndex = PROPERTY_REGEXP.lastIndex;\n }\n }\n\n return result;\n}\n","import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n","import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n","const IS_PLAIN = /^\\w*$/;\nconst IS_DEEP = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\n\n/**\n * Checks if a given key is a deep key.\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @param key - The key to check.\n * @returns {boolean} - Returns true if the key is a deep key, otherwise false.\n *\n * Examples:\n *\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // false\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n */\nexport function isDeepKey(key: PropertyKey): boolean {\n switch (typeof key) {\n case \"number\":\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return !IS_PLAIN.test(key) && IS_DEEP.test(key);\n }\n }\n}\n","import { isDeepKey } from \"../_internal/isDeepKey.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\nimport type { Get } from \"./get.types.ts\";\n\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n * \n * @param {T} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K]} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T>(object: T, path: K | [K]): T[K];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T>(object: T | null | undefined, path: K | [K]): T[K] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T, D>(object: T | null | undefined, path: K | [K], defaultValue: D): Exclude<T[K], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, path: [K1, K2]): T[K1][K2];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T | null | undefined, path: [K1, K2]): T[K1][K2] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], D>(object: T | null | undefined, path: [K1, K2], defaultValue: D): Exclude<T[K1][K2], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T, path: [K1, K2, K3]): T[K1][K2][K3];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T | null | undefined, path: [K1, K2, K3]): T[K1][K2][K3] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], D>(object: T | null | undefined, path: [K1, K2, K3], defaultValue: D): Exclude<T[K1][K2][K3], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T, path: [K1, K2, K3, K4]): T[K1][K2][K3][K4];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T | null | undefined, path: [K1, K2, K3, K4]): T[K1][K2][K3][K4] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3][K4], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], D>(object: T | null | undefined, path: [K1, K2, K3, K4], defaultValue: D): Exclude<T[K1][K2][K3][K4], undefined> | D;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * \n * @param {Record<number, T>} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T} - Returns the resolved value.\n */\nexport function get<T>(object: Record<number, T>, path: number): T;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * \n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T | undefined} - Returns the resolved value.\n */\nexport function get<T>(object: Record<number, T> | null | undefined, path: number): T | undefined;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * @template D - The type of the default value.\n * \n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {T | D} - Returns the resolved value.\n */\nexport function get<T, D>(object: Record<number, T> | null | undefined, path: number, defaultValue: D): T | D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning the default value.\n * \n * @template D - The type of the default value.\n * \n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {D} - Returns the default value.\n */\nexport function get<D>(object: null | undefined, path: PropertyKey, defaultValue: D): D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning undefined.\n * \n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @returns {undefined} - Returns undefined.\n */\nexport function get(object: null | undefined, path: PropertyKey): undefined;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template P - The type of the path.\n * \n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @returns {string extends P ? any : Get<T, P>} - Returns the resolved value.\n */\nexport function get<T, P extends string>(data: T, path: P): string extends P ? any : Get<T, P>;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template P - The type of the path.\n * @template D - The type of the default value.\n * \n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<Get<T, P>, null | undefined> | D} - Returns the resolved value.\n */\nexport function get<T, P extends string, D = Get<T, P>>(data: T, path: P, defaultValue: D): Exclude<Get<T, P>, null | undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @param {unknown} object - The object to query.\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @param {unknown} [defaultValue] - The value returned if the resolved value is undefined.\n * @returns {any} - Returns the resolved value.\n */\nexport function get(object: unknown, path: PropertyKey | readonly PropertyKey[], defaultValue?: unknown): any;\nexport function get(object: any, path: PropertyKey | readonly PropertyKey[], defaultValue?: any): any {\n let resolvedPath;\n\n if (Array.isArray(path)) {\n resolvedPath = path;\n } else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {\n resolvedPath = toPath(path);\n } else {\n resolvedPath = [path];\n }\n\n if (resolvedPath.length === 0) {\n return defaultValue;\n }\n\n let current = object;\n let index;\n\n for (index = 0; index < resolvedPath.length && current != null; index++) {\n let key = resolvedPath[index];\n\n if (Object.is(key.valueOf(), -0)) {\n key = '-0';\n }\n\n current = current[key];\n }\n\n if (current === null && index === resolvedPath.length) {\n return current;\n }\n\n return current ?? defaultValue;\n}","/**\n * Checks if a given value is a plain object.\n * \n * A plain object is an object created by the `{}` literal, `new Object()`, or\n * `Object.create(null)`. \n * \n * This function also handles objects with custom\n * `Symbol.toStringTag` properties.\n * \n * `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the\n * default string description of objects.\n * \n * @param {unknown} [object] - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n * \n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(isPlainObject(new Map())); // false\n */\nexport function isPlainObject(object?: unknown): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n // @ts-ignore\n const tag = object[Symbol.toStringTag];\n\n if (tag == null) {\n return false;\n }\n\n const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;\n\n if (isTagReadonly) {\n return false;\n }\n\n return object.toString() === `[object ${tag}]`;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}","/**\n * Checks if a string contains another string at the beginning of the string.\n *\n * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional offset to start searching in the str string\n * @returns {boolean} - True if the str string starts with the target string.\n *\n * @example\n * const isPrefix = startsWith('fooBar', 'foo') // returns true\n * const isPrefix = startsWith('fooBar', 'bar') // returns false\n * const isPrefix = startsWith('fooBar', 'abc') // returns false\n * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true\n * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false\n */\nexport const startsWith = (str: string, target: string, position: number = 0): boolean => {\n return str.startsWith(target, position);\n};\n","/**\n * Checks if a string contains another string at the end of the string.\n *\n * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional position from the start to search up to this index\n * @returns {boolean} - True if the str string ends with the target string.\n *\n * @example\n * const isPrefix = endsWith('fooBar', 'foo') // returns true\n * const isPrefix = endsWith('fooBar', 'bar') // returns false\n * const isPrefix = endsWith('fooBar', 'abc') // returns false\n * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true\n * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false\n */\nexport const endsWith = (str: string, target: string, position: number = str.length): boolean => {\n return str.endsWith(target, position);\n};\n","/**\n * Finds the element in an array that has the maximum value.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @returns {T} The element with the maximum value.\n * @example\n * // Returns 9\n * max([3, 1, 4, 1, 5, 9])\n *\n * @example\n * // Returns 8\n * max([0, -3, 2, 8, 7])\n */\nexport function max<T>(items: readonly T[] = []): T {\n let maxElement = items[0];\n let max = undefined;\n\n for (const element of items) {\n if (max == null || element > max) {\n max = element;\n maxElement = element;\n }\n }\n\n return maxElement;\n}\n","/**\n * Finds the element in an array that has the minimum value.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @returns {T} The element with the minimum value.\n * @example\n * // Returns 1\n * min([3, 1, 4, 1, 5, 9])\n *\n * @example\n * // Returns -3\n * min([0, -3, 2, 8, 7])\n */\nexport function min<T>(items: readonly T[] = []): T {\n let minElement = items[0];\n let min = undefined;\n\n for (const element of items) {\n if (min == null || element < min) {\n min = element;\n minElement = element;\n }\n }\n\n return minElement;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AK;AAAA,EACrC;AAEA,SAAO,OAAO,eAAe,MAAM,MAAM;AAC3C;;;AC1CO,IAAM,aAAa,CAAC,KAAa,QAAgB,WAAmB,MAAe;AACxF,SAAO,IAAI,WAAW,QAAQ,QAAQ;AACxC;;;ACFO,IAAM,WAAW,CAAC,KAAa,QAAgB,WAAmB,IAAI,WAAoB;AAC/F,SAAO,IAAI,SAAS,QAAQ,QAAQ;AACtC;;;ACLO,SAAS,IAAO,QAAsB,CAAC,GAAM;AAClD,MAAI,aAAa,MAAM,CAAC;AACxB,MAAIC,OAAM;AAEV,aAAW,WAAW,OAAO;AAC3B,QAAIA,QAAO,QAAQ,UAAUA,MAAK;AAChC,MAAAA,OAAM;AACN,mBAAa;AAAA,IACf;AAAA,EACF;AAEA,SAAO;AACT;;;ACZO,SAAS,IAAO,QAAsB,CAAC,GAAM;AAClD,MAAI,aAAa,MAAM,CAAC;AACxB,MAAIC,OAAM;AAEV,aAAW,WAAW,OAAO;AAC3B,QAAIA,QAAO,QAAQ,UAAUA,MAAK;AAChC,MAAAA,OAAM;AACN,mBAAa;AAAA,IACf;AAAA,EACF;AAEA,SAAO;AACT;","names":["chunk","difference","chunk","difference","max","min"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-NKLIE2OI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}