@rimbu/deep 0.14.5 → 1.0.0-alpha.1

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 (86) hide show
  1. package/{src/deep.ts → dist/bun/deep.mts} +7 -7
  2. package/{src/index.ts → dist/bun/index.mts} +5 -5
  3. package/dist/bun/internal.mts +8 -0
  4. package/{src/match.ts → dist/bun/match.mts} +6 -6
  5. package/{src/patch.ts → dist/bun/patch.mts} +9 -4
  6. package/{src/path.ts → dist/bun/path.mts} +2 -2
  7. package/{src/selector.ts → dist/bun/selector.mts} +1 -1
  8. package/dist/cjs/deep.js +590 -0
  9. package/dist/cjs/index.js +663 -0
  10. package/dist/cjs/internal.js +583 -0
  11. package/dist/cjs/match.js +376 -0
  12. package/dist/cjs/patch.js +105 -0
  13. package/dist/cjs/path.js +585 -0
  14. package/dist/cjs/protected.js +18 -0
  15. package/dist/cjs/selector.js +581 -0
  16. package/dist/cjs/tuple.js +73 -0
  17. package/dist/{module/deep.js → esm/deep.mjs} +6 -6
  18. package/dist/esm/deep.mjs.map +1 -0
  19. package/dist/{module/index.js → esm/index.mjs} +5 -5
  20. package/dist/esm/index.mjs.map +1 -0
  21. package/dist/esm/internal.mjs +5 -0
  22. package/dist/esm/internal.mjs.map +1 -0
  23. package/dist/{module/match.js → esm/match.mjs} +21 -21
  24. package/dist/esm/match.mjs.map +1 -0
  25. package/dist/{module/patch.js → esm/patch.mjs} +5 -5
  26. package/dist/esm/patch.mjs.map +1 -0
  27. package/dist/{module/path.js → esm/path.mjs} +2 -2
  28. package/dist/esm/path.mjs.map +1 -0
  29. package/dist/esm/protected.mjs +2 -0
  30. package/dist/esm/protected.mjs.map +1 -0
  31. package/dist/{module/selector.js → esm/selector.mjs} +2 -2
  32. package/dist/esm/selector.mjs.map +1 -0
  33. package/dist/{module/tuple.js → esm/tuple.mjs} +1 -1
  34. package/dist/esm/tuple.mjs.map +1 -0
  35. package/dist/types/{deep.d.ts → deep.d.mts} +6 -6
  36. package/dist/types/{index.d.ts → index.d.mts} +5 -5
  37. package/dist/types/internal.d.mts +7 -0
  38. package/dist/types/{match.d.ts → match.d.mts} +3 -3
  39. package/dist/types/{patch.d.ts → patch.d.mts} +3 -3
  40. package/dist/types/{path.d.ts → path.d.mts} +2 -2
  41. package/dist/types/{selector.d.ts → selector.d.mts} +1 -1
  42. package/package.json +29 -23
  43. package/src/deep.mts +364 -0
  44. package/src/index.mts +23 -0
  45. package/src/internal.mts +8 -0
  46. package/src/match.mts +700 -0
  47. package/src/patch.mts +262 -0
  48. package/src/path.mts +430 -0
  49. package/src/protected.mts +30 -0
  50. package/src/selector.mts +90 -0
  51. package/src/tuple.mts +197 -0
  52. package/dist/main/deep.js +0 -211
  53. package/dist/main/deep.js.map +0 -1
  54. package/dist/main/index.js +0 -19
  55. package/dist/main/index.js.map +0 -1
  56. package/dist/main/internal.js +0 -9
  57. package/dist/main/internal.js.map +0 -1
  58. package/dist/main/match.js +0 -284
  59. package/dist/main/match.js.map +0 -1
  60. package/dist/main/patch.js +0 -133
  61. package/dist/main/patch.js.map +0 -1
  62. package/dist/main/path.js +0 -126
  63. package/dist/main/path.js.map +0 -1
  64. package/dist/main/protected.js +0 -3
  65. package/dist/main/protected.js.map +0 -1
  66. package/dist/main/selector.js +0 -40
  67. package/dist/main/selector.js.map +0 -1
  68. package/dist/main/tuple.js +0 -164
  69. package/dist/main/tuple.js.map +0 -1
  70. package/dist/module/deep.js.map +0 -1
  71. package/dist/module/index.js.map +0 -1
  72. package/dist/module/internal.js +0 -4
  73. package/dist/module/internal.js.map +0 -1
  74. package/dist/module/match.js.map +0 -1
  75. package/dist/module/patch.js.map +0 -1
  76. package/dist/module/path.js.map +0 -1
  77. package/dist/module/protected.js +0 -2
  78. package/dist/module/protected.js.map +0 -1
  79. package/dist/module/selector.js.map +0 -1
  80. package/dist/module/tuple.js.map +0 -1
  81. package/dist/types/internal.d.ts +0 -7
  82. package/src/internal.ts +0 -8
  83. /package/{src/protected.ts → dist/bun/protected.mts} +0 -0
  84. /package/{src/tuple.ts → dist/bun/tuple.mts} +0 -0
  85. /package/dist/types/{protected.d.ts → protected.d.mts} +0 -0
  86. /package/dist/types/{tuple.d.ts → tuple.d.mts} +0 -0
@@ -0,0 +1,581 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/selector.mts
21
+ var selector_exports = {};
22
+ __export(selector_exports, {
23
+ select: () => select
24
+ });
25
+ module.exports = __toCommonJS(selector_exports);
26
+
27
+ // src/path.mts
28
+ var Path;
29
+ ((Path3) => {
30
+ Path3.stringSplitRegex = /\?\.|\.|\[|\]/g;
31
+ function stringSplit(path) {
32
+ return path.split(Path3.stringSplitRegex);
33
+ }
34
+ Path3.stringSplit = stringSplit;
35
+ })(Path || (Path = {}));
36
+ function getAt(source, path) {
37
+ if (path === "") {
38
+ return source;
39
+ }
40
+ const items = Path.stringSplit(path);
41
+ let result = source;
42
+ for (const item of items) {
43
+ if (void 0 === item || item === "" || item === "[") {
44
+ continue;
45
+ }
46
+ if (void 0 === result || null === result) {
47
+ return void 0;
48
+ }
49
+ result = result[item];
50
+ }
51
+ return result;
52
+ }
53
+ function patchAt(source, path, patchItem) {
54
+ if (path === "") {
55
+ return deep_exports.patch(source, patchItem);
56
+ }
57
+ const items = Path.stringSplit(path);
58
+ function createPatchPart(index, target) {
59
+ if (index === items.length) {
60
+ return patchItem;
61
+ }
62
+ const item = items[index];
63
+ if (void 0 === item || item === "") {
64
+ return createPatchPart(index + 1, target);
65
+ }
66
+ if (item === "[") {
67
+ return createPatchPart(index + 1, target);
68
+ }
69
+ const result = {
70
+ [item]: createPatchPart(index + 1, target[item])
71
+ };
72
+ if (Array.isArray(target)) {
73
+ return result;
74
+ }
75
+ return [result];
76
+ }
77
+ return deep_exports.patch(source, createPatchPart(0, source));
78
+ }
79
+
80
+ // src/match.mts
81
+ var import_base = require("@rimbu/base");
82
+ function match(source, matcher, failureLog) {
83
+ return matchEntry(source, source, source, matcher, failureLog);
84
+ }
85
+ function matchEntry(source, parent, root, matcher, failureLog) {
86
+ if (Object.is(source, matcher)) {
87
+ return true;
88
+ }
89
+ if (matcher === null || matcher === void 0) {
90
+ failureLog?.push(
91
+ `value ${JSON.stringify(source)} did not match matcher ${matcher}`
92
+ );
93
+ return false;
94
+ }
95
+ if (typeof source === "function") {
96
+ const result = Object.is(source, matcher);
97
+ if (!result) {
98
+ failureLog?.push(
99
+ `both value and matcher are functions, but they do not have the same reference`
100
+ );
101
+ }
102
+ return result;
103
+ }
104
+ if (typeof matcher === "function") {
105
+ const matcherResult = matcher(source, parent, root);
106
+ if (typeof matcherResult === "boolean") {
107
+ if (!matcherResult) {
108
+ failureLog?.push(
109
+ `function matcher returned false for value ${JSON.stringify(source)}`
110
+ );
111
+ }
112
+ return matcherResult;
113
+ }
114
+ return matchEntry(source, parent, root, matcherResult, failureLog);
115
+ }
116
+ if ((0, import_base.isPlainObj)(source)) {
117
+ return matchPlainObj(source, parent, root, matcher, failureLog);
118
+ }
119
+ if (Array.isArray(source)) {
120
+ return matchArr(source, parent, root, matcher, failureLog);
121
+ }
122
+ failureLog?.push(
123
+ `value ${JSON.stringify(
124
+ source
125
+ )} does not match given matcher ${JSON.stringify(matcher)}`
126
+ );
127
+ return false;
128
+ }
129
+ function matchArr(source, parent, root, matcher, failureLog) {
130
+ if (Array.isArray(matcher)) {
131
+ const length = source.length;
132
+ if (length !== matcher.length) {
133
+ failureLog?.push(
134
+ `array lengths are not equal: value length ${source.length} !== matcher length ${matcher.length}`
135
+ );
136
+ return false;
137
+ }
138
+ let index = -1;
139
+ while (++index < length) {
140
+ if (!matchEntry(source[index], source, root, matcher[index], failureLog)) {
141
+ failureLog?.push(
142
+ `index ${index} does not match with value ${JSON.stringify(
143
+ source[index]
144
+ )} and matcher ${matcher[index]}`
145
+ );
146
+ return false;
147
+ }
148
+ }
149
+ return true;
150
+ }
151
+ if (typeof matcher === "object" && null !== matcher) {
152
+ if (`every` in matcher) {
153
+ return matchCompound(
154
+ source,
155
+ parent,
156
+ root,
157
+ ["every", ...matcher.every],
158
+ failureLog
159
+ );
160
+ }
161
+ if (`some` in matcher) {
162
+ return matchCompound(
163
+ source,
164
+ parent,
165
+ root,
166
+ ["some", ...matcher.some],
167
+ failureLog
168
+ );
169
+ }
170
+ if (`none` in matcher) {
171
+ return matchCompound(
172
+ source,
173
+ parent,
174
+ root,
175
+ ["none", ...matcher.none],
176
+ failureLog
177
+ );
178
+ }
179
+ if (`single` in matcher) {
180
+ return matchCompound(
181
+ source,
182
+ parent,
183
+ root,
184
+ ["single", ...matcher.single],
185
+ failureLog
186
+ );
187
+ }
188
+ if (`someItem` in matcher) {
189
+ return matchTraversal(
190
+ source,
191
+ root,
192
+ "someItem",
193
+ matcher.someItem,
194
+ failureLog
195
+ );
196
+ }
197
+ if (`everyItem` in matcher) {
198
+ return matchTraversal(
199
+ source,
200
+ root,
201
+ "everyItem",
202
+ matcher.everyItem,
203
+ failureLog
204
+ );
205
+ }
206
+ if (`noneItem` in matcher) {
207
+ return matchTraversal(
208
+ source,
209
+ root,
210
+ "noneItem",
211
+ matcher.noneItem,
212
+ failureLog
213
+ );
214
+ }
215
+ if (`singleItem` in matcher) {
216
+ return matchTraversal(
217
+ source,
218
+ root,
219
+ "singleItem",
220
+ matcher.singleItem,
221
+ failureLog
222
+ );
223
+ }
224
+ }
225
+ for (const index in matcher) {
226
+ const matcherAtIndex = matcher[index];
227
+ if (!(index in source)) {
228
+ failureLog?.push(
229
+ `index ${index} does not exist in source ${JSON.stringify(
230
+ source
231
+ )} but should match matcher ${JSON.stringify(matcherAtIndex)}`
232
+ );
233
+ return false;
234
+ }
235
+ const result = matchEntry(
236
+ source[index],
237
+ source,
238
+ root,
239
+ matcherAtIndex,
240
+ failureLog
241
+ );
242
+ if (!result) {
243
+ failureLog?.push(
244
+ `index ${index} does not match with value ${JSON.stringify(
245
+ source[index]
246
+ )} and matcher ${JSON.stringify(matcherAtIndex)}`
247
+ );
248
+ return false;
249
+ }
250
+ }
251
+ return true;
252
+ }
253
+ function matchPlainObj(source, parent, root, matcher, failureLog) {
254
+ if (Array.isArray(matcher)) {
255
+ return matchCompound(source, parent, root, matcher, failureLog);
256
+ }
257
+ for (const key in matcher) {
258
+ if (!(key in source)) {
259
+ failureLog?.push(
260
+ `key ${key} is specified in matcher but not present in value ${JSON.stringify(
261
+ source
262
+ )}`
263
+ );
264
+ return false;
265
+ }
266
+ const result = matchEntry(
267
+ source[key],
268
+ source,
269
+ root,
270
+ matcher[key],
271
+ failureLog
272
+ );
273
+ if (!result) {
274
+ failureLog?.push(
275
+ `key ${key} does not match in value ${JSON.stringify(
276
+ source[key]
277
+ )} with matcher ${JSON.stringify(matcher[key])}`
278
+ );
279
+ return false;
280
+ }
281
+ }
282
+ return true;
283
+ }
284
+ function matchCompound(source, parent, root, compound, failureLog) {
285
+ const matchType = compound[0];
286
+ const length = compound.length;
287
+ let index = 0;
288
+ switch (matchType) {
289
+ case "every": {
290
+ while (++index < length) {
291
+ const result = matchEntry(
292
+ source,
293
+ parent,
294
+ root,
295
+ compound[index],
296
+ failureLog
297
+ );
298
+ if (!result) {
299
+ failureLog?.push(
300
+ `in compound "every": match at index ${index} failed`
301
+ );
302
+ return false;
303
+ }
304
+ }
305
+ return true;
306
+ }
307
+ case "none": {
308
+ while (++index < length) {
309
+ const result = matchEntry(
310
+ source,
311
+ parent,
312
+ root,
313
+ compound[index],
314
+ failureLog
315
+ );
316
+ if (result) {
317
+ failureLog?.push(
318
+ `in compound "none": match at index ${index} succeeded`
319
+ );
320
+ return false;
321
+ }
322
+ }
323
+ return true;
324
+ }
325
+ case "single": {
326
+ let onePassed = false;
327
+ while (++index < length) {
328
+ const result = matchEntry(
329
+ source,
330
+ parent,
331
+ root,
332
+ compound[index],
333
+ failureLog
334
+ );
335
+ if (result) {
336
+ if (onePassed) {
337
+ failureLog?.push(
338
+ `in compound "single": multiple matches succeeded`
339
+ );
340
+ return false;
341
+ }
342
+ onePassed = true;
343
+ }
344
+ }
345
+ if (!onePassed) {
346
+ failureLog?.push(`in compound "single": no matches succeeded`);
347
+ }
348
+ return onePassed;
349
+ }
350
+ case "some": {
351
+ while (++index < length) {
352
+ const result = matchEntry(
353
+ source,
354
+ parent,
355
+ root,
356
+ compound[index],
357
+ failureLog
358
+ );
359
+ if (result) {
360
+ return true;
361
+ }
362
+ }
363
+ failureLog?.push(`in compound "some": no matches succeeded`);
364
+ return false;
365
+ }
366
+ }
367
+ }
368
+ function matchTraversal(source, root, matchType, matcher, failureLog) {
369
+ let index = -1;
370
+ const length = source.length;
371
+ switch (matchType) {
372
+ case "someItem": {
373
+ while (++index < length) {
374
+ if (matchEntry(source[index], source, root, matcher, failureLog)) {
375
+ return true;
376
+ }
377
+ }
378
+ failureLog?.push(
379
+ `in array traversal "someItem": no items matched given matcher`
380
+ );
381
+ return false;
382
+ }
383
+ case "everyItem": {
384
+ while (++index < length) {
385
+ if (!matchEntry(source[index], source, root, matcher, failureLog)) {
386
+ failureLog?.push(
387
+ `in array traversal "everyItem": at least one item did not match given matcher`
388
+ );
389
+ return false;
390
+ }
391
+ }
392
+ return true;
393
+ }
394
+ case "noneItem": {
395
+ while (++index < length) {
396
+ if (matchEntry(source[index], source, root, matcher, failureLog)) {
397
+ failureLog?.push(
398
+ `in array traversal "noneItem": at least one item matched given matcher`
399
+ );
400
+ return false;
401
+ }
402
+ }
403
+ return true;
404
+ }
405
+ case "singleItem": {
406
+ let singleMatched = false;
407
+ while (++index < length) {
408
+ if (matchEntry(source[index], source, root, matcher, failureLog)) {
409
+ if (singleMatched) {
410
+ failureLog?.push(
411
+ `in array traversal "singleItem": more than one item matched given matcher`
412
+ );
413
+ return false;
414
+ }
415
+ singleMatched = true;
416
+ }
417
+ }
418
+ if (!singleMatched) {
419
+ failureLog?.push(
420
+ `in array traversal "singleItem": no item matched given matcher`
421
+ );
422
+ return false;
423
+ }
424
+ return true;
425
+ }
426
+ }
427
+ }
428
+
429
+ // src/deep.mts
430
+ var deep_exports = {};
431
+ __export(deep_exports, {
432
+ getAt: () => getAt,
433
+ getAtWith: () => getAtWith,
434
+ match: () => match,
435
+ matchAt: () => matchAt,
436
+ matchAtWith: () => matchAtWith,
437
+ matchWith: () => matchWith,
438
+ patch: () => patch,
439
+ patchAt: () => patchAt,
440
+ patchAtWith: () => patchAtWith,
441
+ patchWith: () => patchWith,
442
+ protect: () => protect,
443
+ select: () => select,
444
+ selectAt: () => selectAt,
445
+ selectAtWith: () => selectAtWith,
446
+ selectWith: () => selectWith,
447
+ withType: () => withType
448
+ });
449
+
450
+ // src/patch.mts
451
+ var import_base2 = require("@rimbu/base");
452
+ function patch(value, patchItem) {
453
+ return patchEntry(value, value, value, patchItem);
454
+ }
455
+ function patchEntry(value, parent, root, patchItem) {
456
+ if (Object.is(value, patchItem)) {
457
+ return value;
458
+ }
459
+ if (typeof value === "function") {
460
+ return patchItem;
461
+ }
462
+ if (typeof patchItem === "function") {
463
+ const item = patchItem(value, parent, root);
464
+ return patchEntry(value, parent, root, item);
465
+ }
466
+ if ((0, import_base2.isPlainObj)(value)) {
467
+ return patchPlainObj(value, root, patchItem);
468
+ }
469
+ if (Array.isArray(value)) {
470
+ return patchArr(value, root, patchItem);
471
+ }
472
+ return patchItem;
473
+ }
474
+ function patchPlainObj(value, root, patchItem) {
475
+ if (!Array.isArray(patchItem)) {
476
+ return patchItem;
477
+ }
478
+ const result = { ...value };
479
+ let anyChange = false;
480
+ for (const entry of patchItem) {
481
+ const currentRoot = value === root ? { ...result } : root;
482
+ const parent = { ...result };
483
+ for (const key in entry) {
484
+ const currentValue = result[key];
485
+ const newValue = patchEntry(
486
+ currentValue,
487
+ parent,
488
+ currentRoot,
489
+ entry[key]
490
+ );
491
+ if (!Object.is(currentValue, newValue)) {
492
+ anyChange = true;
493
+ result[key] = newValue;
494
+ }
495
+ }
496
+ }
497
+ if (anyChange) {
498
+ return result;
499
+ }
500
+ return value;
501
+ }
502
+ function patchArr(value, root, patchItem) {
503
+ if (Array.isArray(patchItem)) {
504
+ return patchItem;
505
+ }
506
+ const result = [...value];
507
+ let anyChange = false;
508
+ for (const index in patchItem) {
509
+ const numIndex = index;
510
+ const currentValue = result[numIndex];
511
+ const newValue = patchEntry(
512
+ currentValue,
513
+ value,
514
+ root,
515
+ patchItem[index]
516
+ );
517
+ if (!Object.is(newValue, currentValue)) {
518
+ anyChange = true;
519
+ result[numIndex] = newValue;
520
+ }
521
+ }
522
+ if (anyChange) {
523
+ return result;
524
+ }
525
+ return value;
526
+ }
527
+
528
+ // src/deep.mts
529
+ function protect(source) {
530
+ return source;
531
+ }
532
+ function getAtWith(path) {
533
+ return (source) => deep_exports.getAt(source, path);
534
+ }
535
+ function patchWith(patchItem) {
536
+ return (source) => deep_exports.patch(source, patchItem);
537
+ }
538
+ function patchAtWith(path, patchItem) {
539
+ return (source) => deep_exports.patchAt(source, path, patchItem);
540
+ }
541
+ function matchWith(matcher) {
542
+ return (source) => deep_exports.match(source, matcher);
543
+ }
544
+ function matchAt(source, path, matcher) {
545
+ return deep_exports.match(deep_exports.getAt(source, path), matcher);
546
+ }
547
+ function matchAtWith(path, matcher) {
548
+ return (source) => deep_exports.matchAt(source, path, matcher);
549
+ }
550
+ function selectWith(selector) {
551
+ return (source) => deep_exports.select(source, selector);
552
+ }
553
+ function selectAt(source, path, selector) {
554
+ return deep_exports.select(deep_exports.getAt(source, path), selector);
555
+ }
556
+ function selectAtWith(path, selector) {
557
+ return (source) => deep_exports.selectAt(source, path, selector);
558
+ }
559
+ function withType() {
560
+ return deep_exports;
561
+ }
562
+
563
+ // src/selector.mts
564
+ function select(source, selector) {
565
+ if (typeof selector === "function") {
566
+ return selector(source);
567
+ } else if (typeof selector === "string") {
568
+ return deep_exports.getAt(source, selector);
569
+ } else if (Array.isArray(selector)) {
570
+ return selector.map((s) => select(source, s));
571
+ }
572
+ const result = {};
573
+ for (const key in selector) {
574
+ result[key] = select(source, selector[key]);
575
+ }
576
+ return result;
577
+ }
578
+ // Annotate the CommonJS export names for ESM import in node:
579
+ 0 && (module.exports = {
580
+ select
581
+ });
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/tuple.mts
21
+ var tuple_exports = {};
22
+ __export(tuple_exports, {
23
+ Tuple: () => Tuple
24
+ });
25
+ module.exports = __toCommonJS(tuple_exports);
26
+ var import_base = require("@rimbu/base");
27
+ var Tuple;
28
+ ((Tuple2) => {
29
+ function of(...values) {
30
+ return values;
31
+ }
32
+ Tuple2.of = of;
33
+ function getIndex(tuple, index) {
34
+ return tuple[index];
35
+ }
36
+ Tuple2.getIndex = getIndex;
37
+ function first(tuple) {
38
+ return tuple[0];
39
+ }
40
+ Tuple2.first = first;
41
+ function second(tuple) {
42
+ return tuple[1];
43
+ }
44
+ Tuple2.second = second;
45
+ function last(tuple) {
46
+ return tuple[tuple.length - 1];
47
+ }
48
+ Tuple2.last = last;
49
+ function updateAt(tuple, index, updater) {
50
+ return import_base.Arr.update(tuple, index, updater);
51
+ }
52
+ Tuple2.updateAt = updateAt;
53
+ function append(tuple, ...values) {
54
+ return [...tuple, ...values];
55
+ }
56
+ Tuple2.append = append;
57
+ function concat(tuple1, tuple2) {
58
+ return tuple1.concat(tuple2);
59
+ }
60
+ Tuple2.concat = concat;
61
+ function init(tuple) {
62
+ return import_base.Arr.init(tuple);
63
+ }
64
+ Tuple2.init = init;
65
+ function tail(tuple) {
66
+ return import_base.Arr.tail(tuple);
67
+ }
68
+ Tuple2.tail = tail;
69
+ })(Tuple || (Tuple = {}));
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ Tuple
73
+ });
@@ -1,8 +1,8 @@
1
- import { Deep } from './internal';
2
- export { match } from './match';
3
- export { patch } from './patch';
4
- export { getAt, patchAt } from './path';
5
- export { select } from './selector';
1
+ import { Deep } from './internal.mjs';
2
+ export { match } from './match.mjs';
3
+ export { patch } from './patch.mjs';
4
+ export { getAt, patchAt } from './path.mjs';
5
+ export { select } from './selector.mjs';
6
6
  /**
7
7
  * Returns the same value wrapped in the `Protected` type.
8
8
  * @typeparam T - the source value type
@@ -189,4 +189,4 @@ export function selectAtWith(path, selector) {
189
189
  export function withType() {
190
190
  return Deep;
191
191
  }
192
- //# sourceMappingURL=deep.js.map
192
+ //# sourceMappingURL=deep.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep.mjs","sourceRoot":"","sources":["../../src/deep.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAa,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAI,MAAS;IAClC,OAAO,MAAsB,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CACvB,IAAO;IAEP,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CACvB,SAAwB;IAExB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,SAAgB,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,SAAwD;IAExD,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,SAAgB,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAI,OAAiB;IAC5C,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,OAAO,CACrB,MAAS,EACT,IAAO,EACP,OAAiC;IAEjC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAAsC;IAEtC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,OAAc,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CACxB,QAA4B;IAE5B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAKtB,MAAS,EACT,IAAO,EACP,QAA4B;IAE5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAK1B,IAAO,EACP,QAA4B;IAE5B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC;AAkID;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -5,14 +5,14 @@
5
5
  * <br/>
6
6
  * See the [Rimbu docs Deep overview page](/docs/deep/overview) for more information.
7
7
  */
8
- export { Tuple } from './tuple';
9
- export { Path } from './internal';
10
- export * from './deep';
11
- import * as Deep from './deep';
8
+ export { Tuple } from './tuple.mjs';
9
+ export { Path } from './internal.mjs';
10
+ export * from './deep.mjs';
11
+ import * as Deep from './deep.mjs';
12
12
  export {
13
13
  /**
14
14
  * Convenience namespace offering access to most common functions used in the `@rimbu/deep` package.
15
15
  * These are mainly utilities to patch and match plain JavaScript objects.
16
16
  */
17
17
  Deep, };
18
- //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,IAAI,EAA6B,MAAM,gBAAgB,CAAC;AAEjE,cAAc,YAAY,CAAC;AAE3B,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO;AACL;;;GAGG;AACH,IAAI,GACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { Path } from './path.mjs';
2
+ export {} from './match.mjs';
3
+ import * as Deep from './deep.mjs';
4
+ export { Deep };
5
+ //# sourceMappingURL=internal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.mjs","sourceRoot":"","sources":["../../src/internal.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAc,MAAM,aAAa,CAAC;AAIzC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,CAAC"}