@dereekb/util 13.11.1 → 13.11.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.
Files changed (102) hide show
  1. package/eslint/index.cjs.default.js +1 -0
  2. package/eslint/index.cjs.js +607 -0
  3. package/eslint/index.cjs.mjs +2 -0
  4. package/eslint/index.d.ts +1 -0
  5. package/eslint/index.esm.js +603 -0
  6. package/eslint/package.json +23 -0
  7. package/eslint/src/index.d.ts +1 -0
  8. package/eslint/src/lib/comments.d.ts +54 -0
  9. package/eslint/src/lib/index.d.ts +3 -0
  10. package/eslint/src/lib/plugin.d.ts +18 -0
  11. package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +42 -0
  12. package/eslint/src/lib/require-no-side-effects.rule.d.ts +54 -0
  13. package/fetch/package.json +2 -2
  14. package/index.cjs.js +1203 -23
  15. package/index.esm.js +1203 -23
  16. package/package.json +7 -1
  17. package/src/lib/array/array.factory.d.ts +2 -0
  18. package/src/lib/array/array.filter.d.ts +50 -17
  19. package/src/lib/array/array.find.d.ts +1 -0
  20. package/src/lib/array/array.index.d.ts +7 -0
  21. package/src/lib/array/array.indexed.d.ts +21 -0
  22. package/src/lib/array/array.make.d.ts +7 -0
  23. package/src/lib/array/array.random.d.ts +1 -0
  24. package/src/lib/array/array.unique.d.ts +3 -0
  25. package/src/lib/array/array.value.d.ts +7 -0
  26. package/src/lib/auth/auth.role.claims.d.ts +7 -0
  27. package/src/lib/boolean.d.ts +1 -0
  28. package/src/lib/contact/random.d.ts +14 -0
  29. package/src/lib/date/date.d.ts +6 -0
  30. package/src/lib/date/time.d.ts +7 -0
  31. package/src/lib/date/week.d.ts +7 -0
  32. package/src/lib/error/error.d.ts +7 -0
  33. package/src/lib/filter/filter.d.ts +7 -0
  34. package/src/lib/function/function.boolean.d.ts +7 -0
  35. package/src/lib/function/function.forward.d.ts +14 -0
  36. package/src/lib/getter/getter.cache.d.ts +7 -0
  37. package/src/lib/getter/getter.d.ts +34 -0
  38. package/src/lib/getter/getter.map.d.ts +7 -0
  39. package/src/lib/getter/getter.util.d.ts +7 -0
  40. package/src/lib/grouping.d.ts +8 -0
  41. package/src/lib/hash.d.ts +1 -0
  42. package/src/lib/key.d.ts +16 -0
  43. package/src/lib/map/map.key.d.ts +14 -0
  44. package/src/lib/model/id.batch.d.ts +7 -0
  45. package/src/lib/model/id.factory.d.ts +7 -0
  46. package/src/lib/model/model.conversion.d.ts +35 -0
  47. package/src/lib/model/model.copy.d.ts +7 -0
  48. package/src/lib/model/model.d.ts +19 -0
  49. package/src/lib/model/model.modify.d.ts +14 -0
  50. package/src/lib/nodejs/stream.d.ts +7 -0
  51. package/src/lib/number/bound.d.ts +3 -0
  52. package/src/lib/number/dollar.d.ts +7 -0
  53. package/src/lib/number/factory.d.ts +7 -0
  54. package/src/lib/number/random.d.ts +1 -0
  55. package/src/lib/number/round.d.ts +22 -0
  56. package/src/lib/number/sort.d.ts +7 -0
  57. package/src/lib/number/transform.d.ts +7 -0
  58. package/src/lib/object/object.array.delta.d.ts +7 -0
  59. package/src/lib/object/object.equal.d.ts +7 -0
  60. package/src/lib/object/object.filter.pojo.d.ts +87 -0
  61. package/src/lib/object/object.filter.tuple.d.ts +16 -0
  62. package/src/lib/object/object.key.d.ts +14 -0
  63. package/src/lib/object/object.map.d.ts +14 -0
  64. package/src/lib/path/path.d.ts +9 -0
  65. package/src/lib/promise/promise.d.ts +21 -0
  66. package/src/lib/promise/promise.factory.d.ts +7 -0
  67. package/src/lib/promise/promise.task.d.ts +7 -0
  68. package/src/lib/service/handler.config.d.ts +28 -0
  69. package/src/lib/service/handler.d.ts +14 -0
  70. package/src/lib/set/set.d.ts +21 -0
  71. package/src/lib/set/set.decision.d.ts +7 -0
  72. package/src/lib/set/set.delta.d.ts +7 -0
  73. package/src/lib/set/set.selection.d.ts +7 -0
  74. package/src/lib/sort.d.ts +8 -0
  75. package/src/lib/string/char.d.ts +7 -0
  76. package/src/lib/string/dencoder.d.ts +35 -0
  77. package/src/lib/string/factory.d.ts +22 -1
  78. package/src/lib/string/replace.d.ts +78 -0
  79. package/src/lib/string/search.d.ts +7 -0
  80. package/src/lib/string/sort.d.ts +7 -0
  81. package/src/lib/string/string.d.ts +1 -0
  82. package/src/lib/string/transform.d.ts +53 -0
  83. package/src/lib/string/tree.d.ts +7 -0
  84. package/src/lib/string/url.d.ts +7 -0
  85. package/src/lib/tree/tree.array.d.ts +1 -0
  86. package/src/lib/tree/tree.explore.d.ts +3 -0
  87. package/src/lib/type.d.ts +3 -2
  88. package/src/lib/value/bound.d.ts +28 -0
  89. package/src/lib/value/comparator.d.ts +16 -0
  90. package/src/lib/value/decision.d.ts +5 -0
  91. package/src/lib/value/equal.d.ts +2 -0
  92. package/src/lib/value/indexed.d.ts +127 -0
  93. package/src/lib/value/map.d.ts +22 -0
  94. package/src/lib/value/maybe.type.d.ts +2 -2
  95. package/src/lib/value/modifier.d.ts +13 -0
  96. package/src/lib/value/point.d.ts +56 -0
  97. package/src/lib/value/use.d.ts +37 -0
  98. package/src/lib/value/vector.d.ts +7 -0
  99. package/test/index.cjs.js +17 -4
  100. package/test/index.esm.js +17 -4
  101. package/test/package.json +2 -2
  102. package/test/src/lib/shared/shared.fail.d.ts +24 -5
@@ -48,12 +48,19 @@ export type MaybeIndexRef<T extends IndexRef> = Omit<T, 'i'> & Partial<Pick<T, '
48
48
  *
49
49
  * @returns a compare function suitable for Array.sort()
50
50
  *
51
+ * @dbxUtil
52
+ * @dbxUtilCategory value
53
+ * @dbxUtilKind factory
54
+ * @dbxUtilTags value, index, sort, ascending, factory, ref
55
+ * @dbxUtilRelated sort-by-index-ascending-compare-function, sort-by-index-range-ascending-compare-function
56
+ *
51
57
  * @example
52
58
  * ```ts
53
59
  * const items = [{ i: 4 }, { i: 0 }, { i: 2 }];
54
60
  * items.sort(sortAscendingIndexNumberRefFunction());
55
61
  * // items[0].i === 0
56
62
  * ```
63
+ * @__NO_SIDE_EFFECTS__
57
64
  */
58
65
  export declare function sortAscendingIndexNumberRefFunction<T extends IndexRef>(): SortCompareFunction<T>;
59
66
  /**
@@ -99,6 +106,12 @@ export type IndexDeltaGroupFunction<T> = (inputItems: T[], previousItems?: Maybe
99
106
  * @param readIndex - reads an item's index, returning null/undefined for unindexed items
100
107
  * @returns a function that groups items by their index state
101
108
  *
109
+ * @dbxUtil
110
+ * @dbxUtilCategory value
111
+ * @dbxUtilKind factory
112
+ * @dbxUtilTags value, index, delta, group, factory, classify
113
+ * @dbxUtilRelated separate-values, compute-next-free-index-function
114
+ *
102
115
  * @example
103
116
  * ```ts
104
117
  * const groupFn = indexDeltaGroupFunction<{ x: string; i?: number }>((x) => x.i);
@@ -107,6 +120,7 @@ export type IndexDeltaGroupFunction<T> = (inputItems: T[], previousItems?: Maybe
107
120
  * // result.newItems.length === 1 (item without an index)
108
121
  * // result.currentItems.length === 2 (items with indexes)
109
122
  * ```
123
+ * @__NO_SIDE_EFFECTS__
110
124
  */
111
125
  export declare function indexDeltaGroupFunction<T>(readIndex: ReadMaybeIndexFunction<T>): IndexDeltaGroupFunction<T>;
112
126
  /**
@@ -121,8 +135,15 @@ export declare function indexDeltaGroup<T>(readIndex: ReadMaybeIndexFunction<T>,
121
135
  /**
122
136
  * Creates a SortCompareFunction that sorts items in ascending order using a custom index reader.
123
137
  *
138
+ * @dbxUtil
139
+ * @dbxUtilCategory value
140
+ * @dbxUtilKind factory
141
+ * @dbxUtilTags value, index, sort, ascending, factory, compare
142
+ * @dbxUtilRelated sort-ascending-index-number-ref-function, sort-by-index-range-ascending-compare-function
143
+ *
124
144
  * @param readIndex - extracts the index number from each item
125
145
  * @returns a compare function suitable for Array.sort()
146
+ * @__NO_SIDE_EFFECTS__
126
147
  */
127
148
  export declare function sortByIndexAscendingCompareFunction<T>(readIndex: ReadIndexFunction<T>): SortCompareFunction<T>;
128
149
  /**
@@ -139,21 +160,35 @@ export type ComputeNextFreeIndexFunction<T> = (values: T[]) => IndexNumber;
139
160
  * @param nextIndex - optional custom function to compute the next index from the max item; defaults to max + 1
140
161
  * @returns a function that computes the next free index for a given array
141
162
  *
163
+ * @dbxUtil
164
+ * @dbxUtilCategory value
165
+ * @dbxUtilKind factory
166
+ * @dbxUtilTags value, index, free, next, factory, max
167
+ * @dbxUtilRelated compute-next-free-index-on-sorted-values-function, min-and-max-index-function
168
+ *
142
169
  * @example
143
170
  * ```ts
144
171
  * const fn = computeNextFreeIndexFunction<IndexRef>((x) => x.i);
145
172
  * const nextIndex = fn([{ i: 0 }, { i: 1 }, { i: 5 }]);
146
173
  * // nextIndex === 6
147
174
  * ```
175
+ * @__NO_SIDE_EFFECTS__
148
176
  */
149
177
  export declare function computeNextFreeIndexFunction<T>(readIndex: ReadIndexFunction<T>, nextIndex?: (value: T) => IndexNumber): ComputeNextFreeIndexFunction<T>;
150
178
  /**
151
179
  * Creates a {@link ComputeNextFreeIndexFunction} optimized for pre-sorted input arrays.
152
180
  * Instead of scanning all items for the maximum, it reads only the last element.
153
181
  *
182
+ * @dbxUtil
183
+ * @dbxUtilCategory value
184
+ * @dbxUtilKind factory
185
+ * @dbxUtilTags value, index, free, next, sorted, factory, optimized
186
+ * @dbxUtilRelated compute-next-free-index-function
187
+ *
154
188
  * @param readIndex - extracts the index number from each item
155
189
  * @param nextIndex - optional custom function to compute the next index from the last item; defaults to last + 1
156
190
  * @returns a function that computes the next free index from sorted arrays
191
+ * @__NO_SIDE_EFFECTS__
157
192
  */
158
193
  export declare function computeNextFreeIndexOnSortedValuesFunction<T>(readIndex: ReadIndexFunction<T>, nextIndex?: (value: T) => IndexNumber): ComputeNextFreeIndexFunction<T>;
159
194
  /**
@@ -168,12 +203,19 @@ export type MinAndMaxIndexFunction<T> = ((values: Iterable<T>) => MinAndMaxFunct
168
203
  * @param readIndex - extracts the index number from each item
169
204
  * @returns a function returning the min/max indexes, or null for empty input
170
205
  *
206
+ * @dbxUtil
207
+ * @dbxUtilCategory value
208
+ * @dbxUtilKind factory
209
+ * @dbxUtilTags value, index, min, max, factory, range
210
+ * @dbxUtilRelated min-and-max-index, min-and-max-index-items-function
211
+ *
171
212
  * @example
172
213
  * ```ts
173
214
  * const fn = minAndMaxIndexFunction<IndexRef>((x) => x.i);
174
215
  * const result = fn([{ i: 3 }, { i: 0 }, { i: 5 }]);
175
216
  * // result?.min === 0, result?.max === 5
176
217
  * ```
218
+ * @__NO_SIDE_EFFECTS__
177
219
  */
178
220
  export declare function minAndMaxIndexFunction<T>(readIndex: ReadIndexFunction<T>): MinAndMaxIndexFunction<T>;
179
221
  /**
@@ -194,8 +236,15 @@ export type MinAndMaxIndexItemsFunction<T> = MinAndMaxFunction<T> & {
194
236
  * Creates a {@link MinAndMaxIndexItemsFunction} that returns the actual items (not just index numbers)
195
237
  * with the minimum and maximum index values.
196
238
  *
239
+ * @dbxUtil
240
+ * @dbxUtilCategory value
241
+ * @dbxUtilKind factory
242
+ * @dbxUtilTags value, index, min, max, items, factory
243
+ * @dbxUtilRelated min-and-max-index-function, min-and-max-function
244
+ *
197
245
  * @param readIndex - extracts the index number from each item
198
246
  * @returns a function returning the min/max items, or null for empty input
247
+ * @__NO_SIDE_EFFECTS__
199
248
  */
200
249
  export declare function minAndMaxIndexItemsFunction<T>(readIndex: ReadIndexFunction<T>): MinAndMaxIndexItemsFunction<T>;
201
250
  /**
@@ -246,6 +295,14 @@ export type FindBestIndexMatchFunction<T> = <I extends IndexRef>(value: I) => T;
246
295
  * fn({ i: 6 }); // returns { i: 5 }
247
296
  * fn({ i: 11 }); // returns { i: 10 }
248
297
  * ```
298
+ *
299
+ * @dbxUtil
300
+ * @dbxUtilCategory value
301
+ * @dbxUtilKind factory
302
+ * @dbxUtilTags value, index, match, find, factory, lookup
303
+ * @dbxUtilRelated find-best-index-match, safe-find-best-index-match
304
+ *
305
+ * @__NO_SIDE_EFFECTS__
249
306
  */
250
307
  export declare function findBestIndexMatchFunction<T extends IndexRef>(items: Iterable<T>): FindBestIndexMatchFunction<T>;
251
308
  /**
@@ -292,8 +349,15 @@ export type ReadIndexRangeFunction<T> = FactoryWithRequiredInput<IndexRange, T>;
292
349
  * Creates a SortCompareFunction that sorts items by their IndexRange in ascending order.
293
350
  * Sorts by minIndex first, then by maxIndex for items with equal minIndex values.
294
351
  *
352
+ * @dbxUtil
353
+ * @dbxUtilCategory value
354
+ * @dbxUtilKind factory
355
+ * @dbxUtilTags value, index-range, sort, ascending, factory, compare
356
+ * @dbxUtilRelated sort-by-index-ascending-compare-function, index-range-reader-pair-factory
357
+ *
295
358
  * @param readIndexRange - extracts the IndexRange from each item
296
359
  * @returns a compare function suitable for Array.sort()
360
+ * @__NO_SIDE_EFFECTS__
297
361
  */
298
362
  export declare function sortByIndexRangeAscendingCompareFunction<T>(readIndexRange: ReadIndexRangeFunction<T>): SortCompareFunction<T>;
299
363
  /**
@@ -310,8 +374,15 @@ export type IndexRangeReaderPairFactory<T> = FactoryWithRequiredInput<IndexRange
310
374
  /**
311
375
  * Creates a new {@link IndexRangeReaderPairFactory} that pairs each value with its computed IndexRange.
312
376
  *
377
+ * @dbxUtil
378
+ * @dbxUtilCategory value
379
+ * @dbxUtilKind factory
380
+ * @dbxUtilTags value, index-range, pair, factory, reader
381
+ * @dbxUtilRelated sort-by-index-range-ascending-compare-function
382
+ *
313
383
  * @param reader - reads the IndexRange from the input value
314
384
  * @returns a factory that creates IndexRangeReaderPair instances
385
+ * @__NO_SIDE_EFFECTS__
315
386
  */
316
387
  export declare function indexRangeReaderPairFactory<T>(reader: ReadIndexRangeFunction<T>): IndexRangeReaderPairFactory<T>;
317
388
  /**
@@ -334,8 +405,15 @@ export type FitToIndexRangeFunction = (input: IndexNumber) => IndexNumber;
334
405
  /**
335
406
  * Creates a {@link FitToIndexRangeFunction} that clamps index numbers to the given range boundaries.
336
407
  *
408
+ * @dbxUtil
409
+ * @dbxUtilCategory value
410
+ * @dbxUtilKind factory
411
+ * @dbxUtilTags value, index, clamp, range, factory, fit
412
+ * @dbxUtilRelated wrap-index-range-function, bound-number-function
413
+ *
337
414
  * @param input - the range to clamp to
338
415
  * @returns a function that clamps any index to the range
416
+ * @__NO_SIDE_EFFECTS__
339
417
  */
340
418
  export declare function fitToIndexRangeFunction(input: IndexRange): FitToIndexRangeFunction;
341
419
  /**
@@ -350,12 +428,19 @@ export type WrapIndexNumberFunction = WrapNumberFunction;
350
428
  * @param fencePosts - whether to use fencepost semantics (maxIndex is exclusive); defaults to true
351
429
  * @returns a function that wraps any index into the range
352
430
  *
431
+ * @dbxUtil
432
+ * @dbxUtilCategory value
433
+ * @dbxUtilKind factory
434
+ * @dbxUtilTags value, index, wrap, range, factory, modular
435
+ * @dbxUtilRelated fit-to-index-range-function, wrap-number-function
436
+ *
353
437
  * @example
354
438
  * ```ts
355
439
  * const wrap = wrapIndexRangeFunction({ minIndex: 0, maxIndex: 6 });
356
440
  * wrap(6); // 0 (wraps from positive side)
357
441
  * wrap(-1); // 5 (wraps from negative side)
358
442
  * ```
443
+ * @__NO_SIDE_EFFECTS__
359
444
  */
360
445
  export declare function wrapIndexRangeFunction(input: IndexRange, fencePosts?: boolean): WrapIndexNumberFunction;
361
446
  /**
@@ -373,9 +458,16 @@ export declare function indexRangeCheckReaderFunction<T extends IndexRef>(input:
373
458
  /**
374
459
  * Creates an {@link IndexRefRangeCheckFunction} that reads an item's index using a custom reader and checks whether it falls within the specified range.
375
460
  *
461
+ * @dbxUtil
462
+ * @dbxUtilCategory value
463
+ * @dbxUtilKind factory
464
+ * @dbxUtilTags value, index, range, check, factory, predicate
465
+ * @dbxUtilRelated index-range-check-function, is-index-number-in-index-range-function
466
+ *
376
467
  * @param input - the range or range config to check against
377
468
  * @param read - custom function to extract the index from the item
378
469
  * @returns a function that checks whether an item's index is within the range
470
+ * @__NO_SIDE_EFFECTS__
379
471
  */
380
472
  export declare function indexRangeCheckReaderFunction<T>(input: IndexRangeFunctionInput, read: ReadIndexFunction<T>): IndexRefRangeCheckFunction<T>;
381
473
  /**
@@ -409,8 +501,15 @@ export declare function asIndexRangeCheckFunctionConfig(input: IndexRangeFunctio
409
501
  * Creates an {@link IndexRangeCheckFunction} that tests whether an index number falls within the configured range.
410
502
  * The min is inclusive and the max is exclusive by default unless `inclusiveMaxIndex` is set.
411
503
  *
504
+ * @dbxUtil
505
+ * @dbxUtilCategory value
506
+ * @dbxUtilKind factory
507
+ * @dbxUtilTags value, index, range, check, factory, predicate
508
+ * @dbxUtilRelated index-range-check-reader-function, is-index-number-in-index-range-function
509
+ *
412
510
  * @param input - the range or range config to check against
413
511
  * @returns a predicate function for index numbers
512
+ * @__NO_SIDE_EFFECTS__
414
513
  */
415
514
  export declare function indexRangeCheckFunction(input: IndexRangeFunctionInput): IndexRangeCheckFunction;
416
515
  /**
@@ -429,8 +528,15 @@ export declare function isIndexNumberInIndexRange(index: IndexNumber, indexRange
429
528
  /**
430
529
  * Creates an {@link IsIndexNumberInIndexRangeFunction} bound to the given range configuration.
431
530
  *
531
+ * @dbxUtil
532
+ * @dbxUtilCategory value
533
+ * @dbxUtilKind factory
534
+ * @dbxUtilTags value, index, range, check, factory, predicate
535
+ * @dbxUtilRelated is-index-number-in-index-range, index-range-check-function
536
+ *
432
537
  * @param input - the range or range config to bind
433
538
  * @returns a predicate that tests index numbers against the bound range
539
+ * @__NO_SIDE_EFFECTS__
434
540
  */
435
541
  export declare function isIndexNumberInIndexRangeFunction(input: IndexRangeFunctionInput): IsIndexNumberInIndexRangeFunction;
436
542
  /**
@@ -448,8 +554,15 @@ export declare function isIndexRangeInIndexRange(compareIndexRange: IndexRange,
448
554
  /**
449
555
  * Creates an {@link IsIndexRangeInIndexRangeFunction} bound to the given range configuration.
450
556
  *
557
+ * @dbxUtil
558
+ * @dbxUtilCategory value
559
+ * @dbxUtilKind factory
560
+ * @dbxUtilTags value, index-range, contains, decision, factory, predicate
561
+ * @dbxUtilRelated is-index-range-in-index-range, index-range-overlaps-index-range-function
562
+ *
451
563
  * @param input - the bounding range or range config to bind
452
564
  * @returns a predicate that tests whether index ranges are fully contained
565
+ * @__NO_SIDE_EFFECTS__
453
566
  */
454
567
  export declare function isIndexRangeInIndexRangeFunction(input: IndexRangeFunctionInput): IsIndexRangeInIndexRangeFunction;
455
568
  /**
@@ -467,8 +580,15 @@ export declare function indexRangeOverlapsIndexRange(compareIndexRange: IndexRan
467
580
  /**
468
581
  * Creates an {@link IndexRangeOverlapsIndexRangeFunction} bound to the given range configuration.
469
582
  *
583
+ * @dbxUtil
584
+ * @dbxUtilCategory value
585
+ * @dbxUtilKind factory
586
+ * @dbxUtilTags value, index-range, overlap, decision, factory, predicate
587
+ * @dbxUtilRelated is-index-range-in-index-range-function, index-range-check-function
588
+ *
470
589
  * @param input - the reference range or range config to bind
471
590
  * @returns a predicate that tests for overlap with the bound range
591
+ * @__NO_SIDE_EFFECTS__
472
592
  */
473
593
  export declare function indexRangeOverlapsIndexRangeFunction(input: IndexRangeFunctionInput): IndexRangeOverlapsIndexRangeFunction;
474
594
  /**
@@ -514,8 +634,15 @@ export type StepsFromIndexFunction = ((startIndex: number, wrapAround?: boolean,
514
634
  * Creates a {@link StepsFromIndexFunction} that computes the next index after stepping from a start position.
515
635
  * Returns undefined when the result falls outside the range (unless wrapping or fitting is enabled).
516
636
  *
637
+ * @dbxUtil
638
+ * @dbxUtilCategory value
639
+ * @dbxUtilKind factory
640
+ * @dbxUtilTags value, index, step, range, factory, wrap, navigation
641
+ * @dbxUtilRelated wrap-index-range-function, fit-to-index-range-function
642
+ *
517
643
  * @param config - stepping behavior configuration
518
644
  * @returns a function that computes the stepped index
645
+ * @__NO_SIDE_EFFECTS__
519
646
  */
520
647
  export declare function stepsFromIndexFunction(config: StepsFromIndexFunctionConfig): StepsFromIndexFunction;
521
648
  /**
@@ -33,6 +33,7 @@ export type ReadValueFunction<I, O> = MapFunction<I, O>;
33
33
  * maybeDouble(undefined); // undefined
34
34
  * maybeDouble(null); // null
35
35
  * ```
36
+ * @__NO_SIDE_EFFECTS__
36
37
  */
37
38
  export declare function mapMaybeFunction<I, O>(mapFunction: MapFunction<I, O>): MapFunction<Maybe<I>, Maybe<O>>;
38
39
  /**
@@ -66,6 +67,7 @@ export type ApplyMapFunctionWithOptions<I, O, C> = (input: I, target?: Maybe<Par
66
67
  *
67
68
  * @param mapFunction - per-element transformation
68
69
  * @returns a function that maps entire arrays
70
+ * @__NO_SIDE_EFFECTS__
69
71
  */
70
72
  export declare function mapArrayFunction<I, O>(mapFunction: MapFunction<I, O>): MapArrayFunction<MapFunction<I, O>>;
71
73
  /**
@@ -87,14 +89,26 @@ export declare const MAP_IDENTITY: <T>(input: T) => T;
87
89
  /**
88
90
  * Returns the shared {@link MAP_IDENTITY} function cast to the requested type, useful for providing a typed no-op transformation.
89
91
  *
92
+ * @dbxUtil
93
+ * @dbxUtilCategory value
94
+ * @dbxUtilTags map, identity, no-op, typed
95
+ * @dbxUtilRelated map-identity, is-map-identity-function
96
+ *
90
97
  * @returns the singleton identity function typed as `MapFunction<T, T>`
98
+ * @__NO_SIDE_EFFECTS__
91
99
  */
92
100
  export declare function mapIdentityFunction<T>(): MapFunction<T, T>;
93
101
  /**
94
102
  * Checks whether the given function is the singleton {@link MAP_IDENTITY} reference.
95
103
  *
104
+ * @dbxUtil
105
+ * @dbxUtilCategory value
106
+ * @dbxUtilTags map, identity, type-guard, sentinel
107
+ * @dbxUtilRelated map-identity, map-identity-function
108
+ *
96
109
  * @param fn - the function to check
97
110
  * @returns `true` if the function is the identity singleton
111
+ * @__NO_SIDE_EFFECTS__
98
112
  */
99
113
  export declare function isMapIdentityFunction(fn: unknown): fn is typeof MAP_IDENTITY;
100
114
  /**
@@ -156,6 +170,8 @@ export declare function mapFunctionOutput<O extends object, I = unknown>(output:
156
170
  * const result = fnChain('aaaab');
157
171
  * // result === 'aaaab'
158
172
  * ```
173
+ *
174
+ * @__NO_SIDE_EFFECTS__
159
175
  */
160
176
  export declare function chainMapSameFunctions<I>(input: ArrayOrValue<Maybe<MapSameFunction<I>>>): MapSameFunction<I>;
161
177
  /**
@@ -164,10 +180,16 @@ export declare function chainMapSameFunctions<I>(input: ArrayOrValue<Maybe<MapSa
164
180
  * If `apply` is false, or `b` is null/undefined, returns `a` unchanged. This conditional chaining
165
181
  * is useful when a second transform step is optional.
166
182
  *
183
+ * @dbxUtil
184
+ * @dbxUtilCategory value
185
+ * @dbxUtilTags map, chain, compose, pipeline, transform
186
+ * @dbxUtilRelated chain-map-same-functions, map-identity-function
187
+ *
167
188
  * @param a - the first map function
168
189
  * @param b - the optional second map function to chain after `a`
169
190
  * @param apply - when false, skips chaining and returns `a` directly
170
191
  * @returns a composed function piping `a` into `b`, or `a` alone if `b` is absent or `apply` is false
192
+ * @__NO_SIDE_EFFECTS__
171
193
  */
172
194
  export declare function chainMapFunction<I>(a: MapSameFunction<I>, b: Maybe<MapSameFunction<I>>): MapSameFunction<I>;
173
195
  export declare function chainMapFunction<I>(a: MapSameFunction<I>, b: Maybe<MapSameFunction<I>>, apply?: boolean): MapSameFunction<I>;
@@ -1,4 +1,4 @@
1
- import { type NonNever } from 'ts-essentials';
1
+ import { type OmitNeverProperties } from 'ts-essentials';
2
2
  /**
3
3
  * A null/undefined value.
4
4
  */
@@ -18,6 +18,6 @@ export type MaybeSoStrict<T> = T extends Maybe<infer A> ? (A extends Maybe<infer
18
18
  /**
19
19
  * Turns all key values in an object into a Maybe value.
20
20
  */
21
- export type MaybeMap<T extends object> = NonNever<{
21
+ export type MaybeMap<T extends object> = OmitNeverProperties<{
22
22
  [K in keyof T]: T[K] extends MaybeNot ? never : Maybe<T[K]>;
23
23
  }>;
@@ -110,6 +110,13 @@ export declare function removeModifiers<T>(modifiers: ArrayOrValue<Modifier<T>>,
110
110
  * fn(obj);
111
111
  * // obj.x === 1
112
112
  * ```
113
+ *
114
+ * @dbxUtil
115
+ * @dbxUtilCategory value
116
+ * @dbxUtilTags modifier, map, factory, compose
117
+ * @dbxUtilRelated maybe-modifier-map-to-function, modifier
118
+ *
119
+ * @__NO_SIDE_EFFECTS__
113
120
  */
114
121
  export declare function modifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): ModifierFunction<T>;
115
122
  /**
@@ -117,8 +124,14 @@ export declare function modifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): Mo
117
124
  *
118
125
  * Returns undefined if no map is provided, allowing callers to distinguish "no modifiers" from "empty modifiers".
119
126
  *
127
+ * @dbxUtil
128
+ * @dbxUtilCategory value
129
+ * @dbxUtilTags modifier, map, factory, compose, optional
130
+ * @dbxUtilRelated modifier-map-to-function, modifier
131
+ *
120
132
  * @param map - the modifier map to convert
121
133
  * @returns a composed modifier function, or `undefined` if no map is provided
134
+ * @__NO_SIDE_EFFECTS__
122
135
  */
123
136
  export declare function maybeModifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): Maybe<ModifierFunction<T>>;
124
137
  /**
@@ -217,8 +217,15 @@ export type LatLngTupleFunctionConfig = LatLngPointFunctionConfig;
217
217
  * Creates a {@link LatLngTupleFunction} that converts various input formats into `[lat, lng]` tuples,
218
218
  * applying optional precision configuration.
219
219
  *
220
+ * @dbxUtil
221
+ * @dbxUtilCategory value
222
+ * @dbxUtilKind factory
223
+ * @dbxUtilTags value, lat-lng, tuple, factory, geographic, normalize
224
+ * @dbxUtilRelated lat-lng-point-function, lat-lng-string-function
225
+ *
220
226
  * @param config - optional configuration for precision and wrapping behavior
221
227
  * @returns a function that produces lat/lng tuples from flexible inputs
228
+ * @__NO_SIDE_EFFECTS__
222
229
  */
223
230
  export declare function latLngTupleFunction(config?: LatLngTupleFunctionConfig): LatLngTupleFunction;
224
231
  /**
@@ -324,9 +331,16 @@ export type LatLngPointPrecisionFunction = (latLngPoint: LatLngPoint) => LatLngP
324
331
  * Creates a {@link LatLngPointPrecisionFunction} that rounds both lat and lng values
325
332
  * to the specified number of decimal places.
326
333
  *
334
+ * @dbxUtil
335
+ * @dbxUtilCategory value
336
+ * @dbxUtilKind factory
337
+ * @dbxUtilTags value, lat-lng, precision, round, factory, geographic
338
+ * @dbxUtilRelated lat-lng-point-function, cut-value-to-precision-function
339
+ *
327
340
  * @param precision - number of decimal places to retain
328
341
  * @param precisionRounding - optional rounding strategy (e.g., floor, ceil, round)
329
342
  * @returns a function that rounds points to the given precision
343
+ * @__NO_SIDE_EFFECTS__
330
344
  */
331
345
  export declare function latLngPointPrecisionFunction(precision: LatLngPrecision, precisionRounding?: RoundToPrecisionFunctionType): LatLngPointPrecisionFunction;
332
346
  /**
@@ -338,8 +352,15 @@ export type LatLngStringFunctionConfig = LatLngPointFunctionConfig;
338
352
  * Creates a {@link LatLngStringFunction} that converts various input formats into comma-separated lat/lng strings,
339
353
  * applying optional precision configuration.
340
354
  *
355
+ * @dbxUtil
356
+ * @dbxUtilCategory value
357
+ * @dbxUtilKind factory
358
+ * @dbxUtilTags value, lat-lng, string, factory, geographic, normalize
359
+ * @dbxUtilRelated lat-lng-point-function, lat-lng-tuple-function
360
+ *
341
361
  * @param config - optional configuration for precision and wrapping behavior
342
362
  * @returns a function that produces lat/lng strings from flexible inputs
363
+ * @__NO_SIDE_EFFECTS__
343
364
  */
344
365
  export declare function latLngStringFunction(config?: LatLngStringFunctionConfig): LatLngStringFunction;
345
366
  /**
@@ -401,12 +422,19 @@ export declare function latLngPoint(lat: LatLngPointInput, lng?: Longitude): Lat
401
422
  * @returns a function that produces points from flexible inputs
402
423
  * @throws {Error} when the input cannot be parsed into a valid point
403
424
  *
425
+ * @dbxUtil
426
+ * @dbxUtilCategory value
427
+ * @dbxUtilKind factory
428
+ * @dbxUtilTags value, lat-lng, point, factory, geographic, normalize
429
+ * @dbxUtilRelated lat-lng-point, lat-lng-tuple-function, lat-lng-string-function, lat-lng-point-precision-function
430
+ *
404
431
  * @example
405
432
  * ```ts
406
433
  * const fn = latLngPointFunction({ precision: 3 });
407
434
  * const result = fn(30.59929, -96.38315);
408
435
  * // result.lat === 30.599, result.lng === -96.383
409
436
  * ```
437
+ * @__NO_SIDE_EFFECTS__
410
438
  */
411
439
  export declare function latLngPointFunction(config?: LatLngPointFunctionConfig): LatLngPointFunction;
412
440
  /**
@@ -431,8 +459,15 @@ export type ValidLatLngPointFunction = (latLngPoint: LatLngPoint) => LatLngPoint
431
459
  /**
432
460
  * Creates a {@link ValidLatLngPointFunction} that returns the input point when valid, or a default point otherwise.
433
461
  *
462
+ * @dbxUtil
463
+ * @dbxUtilCategory value
464
+ * @dbxUtilKind factory
465
+ * @dbxUtilTags value, lat-lng, validate, fallback, factory, geographic
466
+ * @dbxUtilRelated valid-lat-lng-point, is-valid-lat-lng-point
467
+ *
434
468
  * @param defaultValue - factory for the fallback point; defaults to `defaultLatLngPoint`
435
469
  * @returns a validation function
470
+ * @__NO_SIDE_EFFECTS__
436
471
  */
437
472
  export declare function validLatLngPointFunction(defaultValue?: Factory<LatLngPoint>): ValidLatLngPointFunction;
438
473
  /**
@@ -476,8 +511,15 @@ export type LatLngDataPointFunction<T extends LatLngRef> = (data: T) => LatLngDa
476
511
  /**
477
512
  * Creates a {@link LatLngDataPointFunction} that wraps a {@link LatLngRef} object with its resolved point coordinates.
478
513
  *
514
+ * @dbxUtil
515
+ * @dbxUtilCategory value
516
+ * @dbxUtilKind factory
517
+ * @dbxUtilTags value, lat-lng, data-point, factory, geographic, ref
518
+ * @dbxUtilRelated lat-lng-point-function
519
+ *
479
520
  * @param config - optional configuration for precision and wrapping behavior
480
521
  * @returns a function that produces data points from lat/lng references
522
+ * @__NO_SIDE_EFFECTS__
481
523
  */
482
524
  export declare function latLngDataPointFunction<T extends LatLngRef>(config?: LatLngPointFunctionConfig): LatLngDataPointFunction<T>;
483
525
  /**
@@ -505,8 +547,15 @@ export type RandomLatLngFactory = () => LatLngPoint;
505
547
  * Creates a {@link RandomLatLngFactory} that generates random points within the specified bounding box.
506
548
  * The bounding box corners are capped/wrapped to valid coordinate ranges.
507
549
  *
550
+ * @dbxUtil
551
+ * @dbxUtilCategory value
552
+ * @dbxUtilKind factory
553
+ * @dbxUtilTags value, lat-lng, random, factory, geographic, bounding-box
554
+ * @dbxUtilRelated random-lat-lng-from-center-factory, random-number-factory
555
+ *
508
556
  * @param config - optional bounding box and precision configuration
509
557
  * @returns a factory that produces random points within the bounds
558
+ * @__NO_SIDE_EFFECTS__
510
559
  */
511
560
  export declare function randomLatLngFactory(config?: RandomLatLngFactoryConfig): RandomLatLngFactory;
512
561
  /**
@@ -530,7 +579,14 @@ export interface RandomLatLngFromCenterFactoryConfig extends Pick<RandomLatLngFa
530
579
  * Creates a {@link RandomLatLngFactory} that generates random points within a rectangle
531
580
  * centered on the given point, extending by `latDistance` and `lngDistance` in each direction.
532
581
  *
582
+ * @dbxUtil
583
+ * @dbxUtilCategory value
584
+ * @dbxUtilKind factory
585
+ * @dbxUtilTags value, lat-lng, random, factory, geographic, center
586
+ * @dbxUtilRelated random-lat-lng-factory, random-number-factory
587
+ *
533
588
  * @param config - center point, distances, and optional precision
534
589
  * @returns a factory that produces random points near the center
590
+ * @__NO_SIDE_EFFECTS__
535
591
  */
536
592
  export declare function randomLatLngFromCenterFactory(config: RandomLatLngFromCenterFactoryConfig): RandomLatLngFactory;
@@ -53,15 +53,30 @@ export type MappedUseFunction<A, I> = <O = void>(input: Maybe<A>, use: UseValue<
53
53
  * const fallback = mappedUseFn(undefined, () => 'wrong', 'default');
54
54
  * // fallback === 'default'
55
55
  * ```
56
+ *
57
+ * @dbxUtil
58
+ * @dbxUtilCategory value
59
+ * @dbxUtilKind factory
60
+ * @dbxUtilTags value, use, map, factory, optional, fallback
61
+ * @dbxUtilRelated wrap-use-function, use-context-function
62
+ *
63
+ * @__NO_SIDE_EFFECTS__
56
64
  */
57
65
  export declare function mappedUseFunction<A, I>(map: MapFunction<A, Maybe<I>>): MappedUseFunction<A, I>;
58
66
  /**
59
67
  * Wraps an existing {@link MappedUseFunction} with an additional mapping step, allowing further transformation
60
68
  * of the intermediate value before it reaches the consumer.
61
69
  *
70
+ * @dbxUtil
71
+ * @dbxUtilCategory value
72
+ * @dbxUtilKind factory
73
+ * @dbxUtilTags value, use, map, wrap, compose, factory
74
+ * @dbxUtilRelated mapped-use-function, use-value
75
+ *
62
76
  * @param mappedUseFn - the existing mapped use function to wrap
63
77
  * @param map - additional transformation applied to the intermediate value
64
78
  * @returns a new MappedUseFunction with the extra mapping layer
79
+ * @__NO_SIDE_EFFECTS__
65
80
  */
66
81
  export declare function wrapUseFunction<A, B, I>(mappedUseFn: MappedUseFunction<A, B>, map: MapFunction<B, Maybe<I>>): MappedUseFunction<A, I>;
67
82
  /**
@@ -73,9 +88,16 @@ export type UseContextFunction<I> = <O>(input: Maybe<I>) => Maybe<O>;
73
88
  * Creates a {@link UseContextFunction} by binding a consumer and optional default value, so callers
74
89
  * only need to supply the input.
75
90
  *
91
+ * @dbxUtil
92
+ * @dbxUtilCategory value
93
+ * @dbxUtilKind factory
94
+ * @dbxUtilTags value, use, context, factory, bind, default
95
+ * @dbxUtilRelated use-value, mapped-use-function
96
+ *
76
97
  * @param use - the consumer function to bind
77
98
  * @param defaultValue - fallback when input is null/undefined
78
99
  * @returns a single-argument function that applies the bound consumer
100
+ * @__NO_SIDE_EFFECTS__
79
101
  */
80
102
  export declare function useContextFunction<I, O>(use: UseValue<I, O>, defaultValue?: GetterOrValue<O>): UseContextFunction<I>;
81
103
  /**
@@ -120,14 +142,29 @@ export type MappedUseAsyncFunction<A, I> = <O = void>(input: Maybe<A>, use: UseA
120
142
  * const result = await mappedUseAsyncFn(1, () => Promise.resolve('hello'));
121
143
  * // result === 'hello'
122
144
  * ```
145
+ *
146
+ * @dbxUtil
147
+ * @dbxUtilCategory value
148
+ * @dbxUtilKind factory
149
+ * @dbxUtilTags value, use, async, map, factory, promise
150
+ * @dbxUtilRelated wrap-use-async-function, mapped-use-function
151
+ *
152
+ * @__NO_SIDE_EFFECTS__
123
153
  */
124
154
  export declare function mappedUseAsyncFunction<A, I>(map: MapFunction<A, Maybe<PromiseOrValue<Maybe<I>>>>): MappedUseAsyncFunction<A, I>;
125
155
  /**
126
156
  * Wraps an existing {@link MappedUseAsyncFunction} with an additional async-capable mapping step,
127
157
  * allowing further transformation of the intermediate value before it reaches the consumer.
128
158
  *
159
+ * @dbxUtil
160
+ * @dbxUtilCategory value
161
+ * @dbxUtilKind factory
162
+ * @dbxUtilTags value, use, async, map, wrap, compose, factory, promise
163
+ * @dbxUtilRelated mapped-use-async-function, wrap-use-function
164
+ *
129
165
  * @param mappedUsePromiseFn - the existing async mapped use function to wrap
130
166
  * @param map - additional transformation (sync or async) applied to the intermediate value
131
167
  * @returns a new MappedUseAsyncFunction with the extra mapping layer
168
+ * @__NO_SIDE_EFFECTS__
132
169
  */
133
170
  export declare function wrapUseAsyncFunction<A, B, I>(mappedUsePromiseFn: MappedUseAsyncFunction<A, B>, map: MapFunction<B, Maybe<PromiseOrValue<Maybe<I>>>>): MappedUseAsyncFunction<A, I>;
@@ -42,12 +42,19 @@ export type VectorResizeFunction = (input: Vector) => Vector;
42
42
  * @param minSize - the minimum dimensions to enforce
43
43
  * @returns a resize function that clamps each axis to the specified minimum
44
44
  *
45
+ * @dbxUtil
46
+ * @dbxUtilCategory value
47
+ * @dbxUtilKind factory
48
+ * @dbxUtilTags value, vector, resize, minimum, factory, clamp
49
+ * @dbxUtilRelated vector
50
+ *
45
51
  * @example
46
52
  * ```ts
47
53
  * const resize = vectorMinimumSizeResizeFunction({ x: 5 });
48
54
  * resize({ x: 3, y: 10 });
49
55
  * // { x: 5, y: 10 }
50
56
  * ```
57
+ * @__NO_SIDE_EFFECTS__
51
58
  */
52
59
  export declare function vectorMinimumSizeResizeFunction(minSize: Partial<Vector>): VectorResizeFunction;
53
60
  /**
package/test/index.cjs.js CHANGED
@@ -1090,8 +1090,9 @@ function _ts_generator(thisArg, body) {
1090
1090
  /**
1091
1091
  * Throws an {@link ExpectedFailError} to signal that a test reached the expected failure point.
1092
1092
  *
1093
- * Used within {@link shouldFail} or {@link expectSuccessfulFail} to indicate that the expected
1094
- * error path was taken successfully.
1093
+ * Must be called inside {@link shouldFail} (typically via {@link itShouldFail}) or {@link expectSuccessfulFail},
1094
+ * which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
1095
+ * `it()` block causes the test to fail because the error propagates uncaught.
1095
1096
  *
1096
1097
  * @param message - optional error message
1097
1098
  */ function failSuccessfully(message) {
@@ -1170,11 +1171,23 @@ function _ts_generator(thisArg, body) {
1170
1171
  };
1171
1172
  }
1172
1173
  /**
1173
- * Function that expects any failure to be thrown, then throws an ExpectedFailError.
1174
+ * Function that expects any failure to be thrown, then throws an {@link ExpectedFailError}.
1175
+ *
1176
+ * Intended to be used inside {@link itShouldFail} or {@link shouldFail}, which catch the
1177
+ * `ExpectedFailError` and treat it as a passing test. When used inside a plain `it()` block
1178
+ * the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
1179
+ * as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
1174
1180
  *
1175
1181
  * @param errorFn - function expected to throw an error (sync or async)
1176
1182
  * @param assertFailType - optional assertion to validate the type or content of the thrown error
1177
- * @returns a promise that resolves when the expected failure is verified
1183
+ * @returns a promise that rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully
1184
+ *
1185
+ * @example
1186
+ * ```ts
1187
+ * itShouldFail('when the user is not authorized', async () => {
1188
+ * await expectFail(() => callProtectedEndpoint(), expectFailAssertHttpErrorServerErrorCode(403));
1189
+ * });
1190
+ * ```
1178
1191
  */ function expectFail(errorFn, assertFailType) {
1179
1192
  function handleError(e) {
1180
1193
  if (_instanceof(e, UnexpectedSuccessFailureError)) {