@dereekb/util 13.11.14 → 13.11.15
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/eslint/index.cjs.js +10008 -394
- package/eslint/index.esm.js +9982 -392
- package/eslint/package.json +4 -4
- package/eslint/src/lib/comments.d.ts +14 -3
- package/eslint/src/lib/dbx-tag-families.d.ts +280 -0
- package/eslint/src/lib/index.d.ts +26 -3
- package/eslint/src/lib/jsdoc-parser.d.ts +116 -0
- package/eslint/src/lib/no-inline-string-empty-object-intersection.rule.d.ts +44 -0
- package/eslint/src/lib/no-inline-type-import.rule.d.ts +38 -0
- package/eslint/src/lib/no-sister-re-export.rule.d.ts +69 -0
- package/eslint/src/lib/plugin.d.ts +52 -1
- package/eslint/src/lib/prefer-canonical-jsdoc.rule.d.ts +68 -0
- package/eslint/src/lib/prefer-config-object.rule.d.ts +61 -0
- package/eslint/src/lib/prefer-maybe-type.rule.d.ts +72 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +1 -1
- package/eslint/src/lib/prefer-suggested-string.rule.d.ts +51 -0
- package/eslint/src/lib/require-constant-naming.rule.d.ts +63 -0
- package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +45 -0
- package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +42 -0
- package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-firebase-index-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +74 -0
- package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-default-prefix-naming.rule.d.ts +60 -0
- package/eslint/src/lib/require-deprecated-alias-placement.rule.d.ts +75 -0
- package/eslint/src/lib/require-exported-jsdoc-example.rule.d.ts +61 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +1 -1
- package/eslint/src/lib/require-readonly-config-params.rule.d.ts +57 -0
- package/eslint/src/lib/require-single-return.rule.d.ts +42 -0
- package/fetch/index.cjs.js +95 -80
- package/fetch/index.esm.js +95 -80
- package/fetch/package.json +2 -2
- package/fetch/src/lib/error.d.ts +2 -2
- package/fetch/src/lib/fetch.d.ts +15 -15
- package/fetch/src/lib/fetch.file.d.ts +5 -5
- package/fetch/src/lib/fetch.limit.d.ts +2 -2
- package/fetch/src/lib/fetch.page.d.ts +1 -1
- package/fetch/src/lib/fetch.page.iterate.d.ts +4 -4
- package/fetch/src/lib/fetch.type.d.ts +3 -2
- package/fetch/src/lib/fetch.url.d.ts +13 -13
- package/fetch/src/lib/json.d.ts +12 -12
- package/fetch/src/lib/timeout.d.ts +2 -2
- package/fetch/src/lib/url.d.ts +11 -11
- package/index.cjs.js +2592 -2329
- package/index.esm.js +2590 -2327
- package/package.json +1 -1
- package/src/lib/array/array.boolean.d.ts +20 -20
- package/src/lib/array/array.d.ts +73 -72
- package/src/lib/array/array.factory.d.ts +8 -5
- package/src/lib/array/array.filter.d.ts +23 -20
- package/src/lib/array/array.find.d.ts +9 -8
- package/src/lib/array/array.index.d.ts +15 -14
- package/src/lib/array/array.indexed.d.ts +22 -19
- package/src/lib/array/array.make.d.ts +3 -2
- package/src/lib/array/array.map.d.ts +5 -5
- package/src/lib/array/array.number.d.ts +27 -27
- package/src/lib/array/array.random.d.ts +11 -10
- package/src/lib/array/array.set.d.ts +14 -14
- package/src/lib/array/array.string.d.ts +31 -31
- package/src/lib/array/array.unique.d.ts +22 -20
- package/src/lib/array/array.value.d.ts +3 -2
- package/src/lib/assertion/assert.error.d.ts +8 -8
- package/src/lib/assertion/assertion.d.ts +5 -5
- package/src/lib/assertion/assertion.generic.d.ts +3 -3
- package/src/lib/assertion/assertion.number.d.ts +6 -6
- package/src/lib/auth/auth.role.claims.d.ts +12 -11
- package/src/lib/auth/auth.role.d.ts +3 -3
- package/src/lib/auth/pkce.d.ts +2 -2
- package/src/lib/boolean.d.ts +11 -11
- package/src/lib/cache/cache.memoize.d.ts +6 -6
- package/src/lib/contact/domain.d.ts +9 -9
- package/src/lib/contact/email.d.ts +11 -11
- package/src/lib/contact/phone.d.ts +12 -12
- package/src/lib/contact/random.d.ts +11 -9
- package/src/lib/date/date.d.ts +60 -59
- package/src/lib/date/date.time.d.ts +2 -2
- package/src/lib/date/date.unix.d.ts +8 -8
- package/src/lib/date/duration.d.ts +17 -17
- package/src/lib/date/expires.d.ts +29 -27
- package/src/lib/date/hour.d.ts +23 -23
- package/src/lib/date/minute.d.ts +6 -6
- package/src/lib/date/time.d.ts +10 -9
- package/src/lib/date/week.d.ts +32 -31
- package/src/lib/encryption/encryption.object.d.ts +3 -3
- package/src/lib/error/error.d.ts +13 -12
- package/src/lib/error/error.server.d.ts +4 -4
- package/src/lib/file/pdf.d.ts +4 -4
- package/src/lib/filter/filter.d.ts +3 -2
- package/src/lib/function/function.boolean.d.ts +4 -3
- package/src/lib/function/function.forward.d.ts +6 -4
- package/src/lib/getter/getter.d.ts +24 -19
- package/src/lib/getter/getter.map.d.ts +6 -5
- package/src/lib/getter/getter.util.d.ts +3 -2
- package/src/lib/grouping.d.ts +25 -24
- package/src/lib/hash.d.ts +11 -10
- package/src/lib/iterable/iterable.d.ts +39 -39
- package/src/lib/iterable/iterable.map.d.ts +3 -3
- package/src/lib/key.d.ts +16 -16
- package/src/lib/map/map.d.ts +12 -12
- package/src/lib/map/map.intersection.d.ts +3 -3
- package/src/lib/map/map.key.d.ts +16 -14
- package/src/lib/misc/host.d.ts +2 -2
- package/src/lib/model/id.batch.d.ts +4 -3
- package/src/lib/model/id.factory.d.ts +4 -3
- package/src/lib/model/model.conversion.d.ts +19 -14
- package/src/lib/model/model.conversion.field.d.ts +2 -2
- package/src/lib/model/model.copy.d.ts +5 -4
- package/src/lib/model/model.d.ts +48 -46
- package/src/lib/model/model.modify.d.ts +10 -8
- package/src/lib/nodejs/stream.d.ts +6 -5
- package/src/lib/number/bitwise.dencoder.d.ts +12 -12
- package/src/lib/number/bound.d.ts +16 -13
- package/src/lib/number/dollar.d.ts +6 -5
- package/src/lib/number/encoded.d.ts +7 -7
- package/src/lib/number/factory.d.ts +4 -3
- package/src/lib/number/number.d.ts +37 -37
- package/src/lib/number/random.d.ts +11 -10
- package/src/lib/number/round.d.ts +34 -30
- package/src/lib/number/sort.d.ts +3 -2
- package/src/lib/number/transform.d.ts +5 -4
- package/src/lib/object/object.array.d.ts +6 -6
- package/src/lib/object/object.array.delta.d.ts +3 -2
- package/src/lib/object/object.d.ts +12 -12
- package/src/lib/object/object.empty.d.ts +3 -3
- package/src/lib/object/object.equal.d.ts +11 -10
- package/src/lib/object/object.filter.pojo.d.ts +74 -74
- package/src/lib/object/object.filter.tuple.d.ts +26 -26
- package/src/lib/object/object.flatten.d.ts +4 -4
- package/src/lib/object/object.key.d.ts +6 -4
- package/src/lib/object/object.map.d.ts +15 -13
- package/src/lib/page/page.d.ts +5 -5
- package/src/lib/page/page.filter.d.ts +8 -8
- package/src/lib/path/path.d.ts +98 -88
- package/src/lib/promise/callback.d.ts +2 -2
- package/src/lib/promise/is.d.ts +6 -6
- package/src/lib/promise/poll.d.ts +9 -9
- package/src/lib/promise/promise.d.ts +33 -30
- package/src/lib/promise/promise.factory.d.ts +4 -3
- package/src/lib/promise/promise.loop.d.ts +11 -11
- package/src/lib/promise/promise.task.d.ts +6 -5
- package/src/lib/promise/promise.type.d.ts +3 -3
- package/src/lib/promise/use.d.ts +3 -3
- package/src/lib/relation/relation.d.ts +15 -15
- package/src/lib/service/handler.config.d.ts +20 -16
- package/src/lib/service/handler.d.ts +3 -2
- package/src/lib/service/typed.service.d.ts +2 -2
- package/src/lib/set/set.d.ts +62 -59
- package/src/lib/set/set.delta.d.ts +5 -4
- package/src/lib/set/set.hashset.d.ts +5 -5
- package/src/lib/set/set.selection.d.ts +5 -4
- package/src/lib/sort.d.ts +11 -11
- package/src/lib/storage/storage.d.ts +2 -1
- package/src/lib/storage/storage.error.d.ts +4 -4
- package/src/lib/storage/storage.memory.d.ts +7 -7
- package/src/lib/storage/storage.object.d.ts +5 -5
- package/src/lib/string/case.d.ts +6 -6
- package/src/lib/string/char.d.ts +30 -29
- package/src/lib/string/dencoder.d.ts +25 -20
- package/src/lib/string/factory.d.ts +11 -8
- package/src/lib/string/html.d.ts +19 -19
- package/src/lib/string/mimetype.d.ts +9 -8
- package/src/lib/string/prefix.d.ts +8 -8
- package/src/lib/string/replace.d.ts +45 -39
- package/src/lib/string/search.d.ts +5 -4
- package/src/lib/string/sort.d.ts +13 -4
- package/src/lib/string/string.d.ts +44 -43
- package/src/lib/string/transform.d.ts +32 -23
- package/src/lib/string/tree.d.ts +5 -4
- package/src/lib/string/url.d.ts +5 -4
- package/src/lib/tree/tree.array.d.ts +5 -4
- package/src/lib/tree/tree.expand.d.ts +6 -6
- package/src/lib/tree/tree.explore.d.ts +13 -10
- package/src/lib/tree/tree.flatten.d.ts +10 -10
- package/src/lib/type.d.ts +42 -12
- package/src/lib/value/address.d.ts +7 -7
- package/src/lib/value/bound.d.ts +70 -66
- package/src/lib/value/build.d.ts +6 -6
- package/src/lib/value/comparator.d.ts +19 -17
- package/src/lib/value/cron.d.ts +2 -2
- package/src/lib/value/decision.d.ts +6 -5
- package/src/lib/value/equal.d.ts +11 -9
- package/src/lib/value/indexed.d.ts +101 -85
- package/src/lib/value/label.d.ts +2 -2
- package/src/lib/value/map.d.ts +20 -16
- package/src/lib/value/maybe.d.ts +36 -36
- package/src/lib/value/modifier.d.ts +24 -23
- package/src/lib/value/point.d.ts +85 -77
- package/src/lib/value/url.d.ts +2 -2
- package/src/lib/value/use.d.ts +36 -33
- package/src/lib/value/vector.d.ts +15 -14
- package/test/index.cjs.js +41 -36
- package/test/index.esm.js +41 -36
- package/test/package.json +2 -2
- package/test/src/lib/jest/jest.fail.d.ts +2 -2
- package/test/src/lib/shared/shared.d.ts +20 -20
- package/test/src/lib/shared/shared.fail.d.ts +21 -16
- package/test/src/lib/shared/shared.function.d.ts +4 -4
- package/test/src/lib/shared/shared.wrap.d.ts +10 -10
|
@@ -35,8 +35,8 @@ export interface IndexRef {
|
|
|
35
35
|
/**
|
|
36
36
|
* Convenience function for calling readKeysToMap() and keying the values by their index number.
|
|
37
37
|
*
|
|
38
|
-
* @param items -
|
|
39
|
-
* @returns
|
|
38
|
+
* @param items - Array of IndexRef items to index.
|
|
39
|
+
* @returns Map keyed by each item's index number.
|
|
40
40
|
*/
|
|
41
41
|
export declare function indexRefMap<T extends IndexRef>(items: T[]): Map<IndexNumber, T>;
|
|
42
42
|
/**
|
|
@@ -46,7 +46,7 @@ export type MaybeIndexRef<T extends IndexRef> = Omit<T, 'i'> & Partial<Pick<T, '
|
|
|
46
46
|
/**
|
|
47
47
|
* Creates a SortCompareFunction that sorts IndexRef values in ascending order by their index number.
|
|
48
48
|
*
|
|
49
|
-
* @returns
|
|
49
|
+
* @returns A compare function suitable for Array.sort()
|
|
50
50
|
*
|
|
51
51
|
* @dbxUtil
|
|
52
52
|
* @dbxUtilCategory value
|
|
@@ -60,6 +60,7 @@ export type MaybeIndexRef<T extends IndexRef> = Omit<T, 'i'> & Partial<Pick<T, '
|
|
|
60
60
|
* items.sort(sortAscendingIndexNumberRefFunction());
|
|
61
61
|
* // items[0].i === 0
|
|
62
62
|
* ```
|
|
63
|
+
*
|
|
63
64
|
* @__NO_SIDE_EFFECTS__
|
|
64
65
|
*/
|
|
65
66
|
export declare function sortAscendingIndexNumberRefFunction<T extends IndexRef>(): SortCompareFunction<T>;
|
|
@@ -74,8 +75,8 @@ export type ReadMaybeIndexFunction<T> = (value: T) => Maybe<IndexNumber>;
|
|
|
74
75
|
/**
|
|
75
76
|
* Reads an IndexNumber from an IndexRef.
|
|
76
77
|
*
|
|
77
|
-
* @param indexRef -
|
|
78
|
-
* @returns
|
|
78
|
+
* @param indexRef - The ref to read from.
|
|
79
|
+
* @returns The index number value.
|
|
79
80
|
*/
|
|
80
81
|
export declare function readIndexNumber(indexRef: IndexRef): IndexNumber;
|
|
81
82
|
export interface IndexDeltaGroup<T> {
|
|
@@ -103,8 +104,8 @@ export type IndexDeltaGroupFunction<T> = (inputItems: T[], previousItems?: Maybe
|
|
|
103
104
|
* and deleted (present in previous but missing from current) groups. Useful for computing deltas when
|
|
104
105
|
* items are added or removed from an indexed collection.
|
|
105
106
|
*
|
|
106
|
-
* @param readIndex -
|
|
107
|
-
* @returns
|
|
107
|
+
* @param readIndex - Reads an item's index, returning null/undefined for unindexed items.
|
|
108
|
+
* @returns Groups items by their index state.
|
|
108
109
|
*
|
|
109
110
|
* @dbxUtil
|
|
110
111
|
* @dbxUtilCategory value
|
|
@@ -120,29 +121,31 @@ export type IndexDeltaGroupFunction<T> = (inputItems: T[], previousItems?: Maybe
|
|
|
120
121
|
* // result.newItems.length === 1 (item without an index)
|
|
121
122
|
* // result.currentItems.length === 2 (items with indexes)
|
|
122
123
|
* ```
|
|
124
|
+
*
|
|
123
125
|
* @__NO_SIDE_EFFECTS__
|
|
124
126
|
*/
|
|
125
127
|
export declare function indexDeltaGroupFunction<T>(readIndex: ReadMaybeIndexFunction<T>): IndexDeltaGroupFunction<T>;
|
|
126
128
|
/**
|
|
127
129
|
* Convenience function that creates and immediately invokes an {@link IndexDeltaGroupFunction}.
|
|
128
130
|
*
|
|
129
|
-
* @param readIndex -
|
|
130
|
-
* @param inputItems -
|
|
131
|
-
* @param previousItems -
|
|
132
|
-
* @returns
|
|
131
|
+
* @param readIndex - Reads an item's index.
|
|
132
|
+
* @param inputItems - The current set of items.
|
|
133
|
+
* @param previousItems - The previous set of items for computing deletions.
|
|
134
|
+
* @returns The grouped delta result.
|
|
133
135
|
*/
|
|
134
136
|
export declare function indexDeltaGroup<T>(readIndex: ReadMaybeIndexFunction<T>, inputItems: T[], previousItems?: Maybe<T[]>): IndexDeltaGroup<T>;
|
|
135
137
|
/**
|
|
136
138
|
* Creates a SortCompareFunction that sorts items in ascending order using a custom index reader.
|
|
137
139
|
*
|
|
140
|
+
* @param readIndex - Extracts the index number from each item.
|
|
141
|
+
* @returns A compare function suitable for Array.sort()
|
|
142
|
+
*
|
|
138
143
|
* @dbxUtil
|
|
139
144
|
* @dbxUtilCategory value
|
|
140
145
|
* @dbxUtilKind factory
|
|
141
146
|
* @dbxUtilTags value, index, sort, ascending, factory, compare
|
|
142
147
|
* @dbxUtilRelated sort-ascending-index-number-ref-function, sort-by-index-range-ascending-compare-function
|
|
143
148
|
*
|
|
144
|
-
* @param readIndex - extracts the index number from each item
|
|
145
|
-
* @returns a compare function suitable for Array.sort()
|
|
146
149
|
* @__NO_SIDE_EFFECTS__
|
|
147
150
|
*/
|
|
148
151
|
export declare function sortByIndexAscendingCompareFunction<T>(readIndex: ReadIndexFunction<T>): SortCompareFunction<T>;
|
|
@@ -156,9 +159,9 @@ export type ComputeNextFreeIndexFunction<T> = (values: T[]) => IndexNumber;
|
|
|
156
159
|
* Creates a {@link ComputeNextFreeIndexFunction} that finds the maximum index in the input and returns the next available one.
|
|
157
160
|
* Returns 0 when the input is empty.
|
|
158
161
|
*
|
|
159
|
-
* @param readIndex -
|
|
160
|
-
* @param nextIndex -
|
|
161
|
-
* @returns
|
|
162
|
+
* @param readIndex - Extracts the index number from each item.
|
|
163
|
+
* @param nextIndex - Optional custom function to compute the next index from the max item; defaults to max + 1.
|
|
164
|
+
* @returns Computes the next free index for a given array.
|
|
162
165
|
*
|
|
163
166
|
* @dbxUtil
|
|
164
167
|
* @dbxUtilCategory value
|
|
@@ -172,6 +175,7 @@ export type ComputeNextFreeIndexFunction<T> = (values: T[]) => IndexNumber;
|
|
|
172
175
|
* const nextIndex = fn([{ i: 0 }, { i: 1 }, { i: 5 }]);
|
|
173
176
|
* // nextIndex === 6
|
|
174
177
|
* ```
|
|
178
|
+
*
|
|
175
179
|
* @__NO_SIDE_EFFECTS__
|
|
176
180
|
*/
|
|
177
181
|
export declare function computeNextFreeIndexFunction<T>(readIndex: ReadIndexFunction<T>, nextIndex?: (value: T) => IndexNumber): ComputeNextFreeIndexFunction<T>;
|
|
@@ -179,15 +183,16 @@ export declare function computeNextFreeIndexFunction<T>(readIndex: ReadIndexFunc
|
|
|
179
183
|
* Creates a {@link ComputeNextFreeIndexFunction} optimized for pre-sorted input arrays.
|
|
180
184
|
* Instead of scanning all items for the maximum, it reads only the last element.
|
|
181
185
|
*
|
|
186
|
+
* @param readIndex - Extracts the index number from each item.
|
|
187
|
+
* @param nextIndex - Optional custom function to compute the next index from the last item; defaults to last + 1.
|
|
188
|
+
* @returns Computes the next free index from sorted arrays.
|
|
189
|
+
*
|
|
182
190
|
* @dbxUtil
|
|
183
191
|
* @dbxUtilCategory value
|
|
184
192
|
* @dbxUtilKind factory
|
|
185
193
|
* @dbxUtilTags value, index, free, next, sorted, factory, optimized
|
|
186
194
|
* @dbxUtilRelated compute-next-free-index-function
|
|
187
195
|
*
|
|
188
|
-
* @param readIndex - extracts the index number from each item
|
|
189
|
-
* @param nextIndex - optional custom function to compute the next index from the last item; defaults to last + 1
|
|
190
|
-
* @returns a function that computes the next free index from sorted arrays
|
|
191
196
|
* @__NO_SIDE_EFFECTS__
|
|
192
197
|
*/
|
|
193
198
|
export declare function computeNextFreeIndexOnSortedValuesFunction<T>(readIndex: ReadIndexFunction<T>, nextIndex?: (value: T) => IndexNumber): ComputeNextFreeIndexFunction<T>;
|
|
@@ -200,8 +205,8 @@ export type MinAndMaxIndexFunction<T> = ((values: Iterable<T>) => MinAndMaxFunct
|
|
|
200
205
|
/**
|
|
201
206
|
* Creates a {@link MinAndMaxIndexFunction} that extracts the minimum and maximum index numbers from a collection.
|
|
202
207
|
*
|
|
203
|
-
* @param readIndex -
|
|
204
|
-
* @returns
|
|
208
|
+
* @param readIndex - Extracts the index number from each item.
|
|
209
|
+
* @returns The min/max indexes, or null for empty input.
|
|
205
210
|
*
|
|
206
211
|
* @dbxUtil
|
|
207
212
|
* @dbxUtilCategory value
|
|
@@ -215,6 +220,7 @@ export type MinAndMaxIndexFunction<T> = ((values: Iterable<T>) => MinAndMaxFunct
|
|
|
215
220
|
* const result = fn([{ i: 3 }, { i: 0 }, { i: 5 }]);
|
|
216
221
|
* // result?.min === 0, result?.max === 5
|
|
217
222
|
* ```
|
|
223
|
+
*
|
|
218
224
|
* @__NO_SIDE_EFFECTS__
|
|
219
225
|
*/
|
|
220
226
|
export declare function minAndMaxIndexFunction<T>(readIndex: ReadIndexFunction<T>): MinAndMaxIndexFunction<T>;
|
|
@@ -222,8 +228,8 @@ export declare function minAndMaxIndexFunction<T>(readIndex: ReadIndexFunction<T
|
|
|
222
228
|
* Returns the min and max index numbers from an array of IndexRef values.
|
|
223
229
|
* Convenience wrapper around {@link minAndMaxIndexFunction} using {@link readIndexNumber}.
|
|
224
230
|
*
|
|
225
|
-
* @param values -
|
|
226
|
-
* @returns
|
|
231
|
+
* @param values - The IndexRef items to scan.
|
|
232
|
+
* @returns The min/max indexes, or null for empty input.
|
|
227
233
|
*/
|
|
228
234
|
export declare function minAndMaxIndex<T extends IndexRef>(values: T[]): MinAndMaxFunctionResult<IndexNumber>;
|
|
229
235
|
/**
|
|
@@ -236,22 +242,23 @@ export type MinAndMaxIndexItemsFunction<T> = MinAndMaxFunction<T> & {
|
|
|
236
242
|
* Creates a {@link MinAndMaxIndexItemsFunction} that returns the actual items (not just index numbers)
|
|
237
243
|
* with the minimum and maximum index values.
|
|
238
244
|
*
|
|
245
|
+
* @param readIndex - Extracts the index number from each item.
|
|
246
|
+
* @returns The min/max items, or null for empty input.
|
|
247
|
+
*
|
|
239
248
|
* @dbxUtil
|
|
240
249
|
* @dbxUtilCategory value
|
|
241
250
|
* @dbxUtilKind factory
|
|
242
251
|
* @dbxUtilTags value, index, min, max, items, factory
|
|
243
252
|
* @dbxUtilRelated min-and-max-index-function, min-and-max-function
|
|
244
253
|
*
|
|
245
|
-
* @param readIndex - extracts the index number from each item
|
|
246
|
-
* @returns a function returning the min/max items, or null for empty input
|
|
247
254
|
* @__NO_SIDE_EFFECTS__
|
|
248
255
|
*/
|
|
249
256
|
export declare function minAndMaxIndexItemsFunction<T>(readIndex: ReadIndexFunction<T>): MinAndMaxIndexItemsFunction<T>;
|
|
250
257
|
/**
|
|
251
258
|
* Creates a HashSet with items keyed by their IndexNumber, providing O(1) lookups by index.
|
|
252
259
|
*
|
|
253
|
-
* @param input -
|
|
254
|
-
* @returns
|
|
260
|
+
* @param input - Optional initial values to populate the set.
|
|
261
|
+
* @returns A HashSet keyed by index number.
|
|
255
262
|
*/
|
|
256
263
|
export declare function hashSetForIndexed<T extends IndexRef>(input?: ArrayOrValue<T>): HashSet<IndexNumber, T>;
|
|
257
264
|
export interface FindItemsByIndexInput<T extends IndexRef> extends Pick<FindValuesFromInput<T, IndexNumber>, 'values' | 'exclude'> {
|
|
@@ -263,8 +270,8 @@ export interface FindItemsByIndexInput<T extends IndexRef> extends Pick<FindValu
|
|
|
263
270
|
/**
|
|
264
271
|
* Returns all values whose index matches one of the specified indexes.
|
|
265
272
|
*
|
|
266
|
-
* @param config -
|
|
267
|
-
* @returns
|
|
273
|
+
* @param config - Specifies the values to search, indexes to match, and optional exclusion flag.
|
|
274
|
+
* @returns The matching items.
|
|
268
275
|
*
|
|
269
276
|
* @example
|
|
270
277
|
* ```ts
|
|
@@ -282,9 +289,15 @@ export type FindBestIndexMatchFunction<T> = <I extends IndexRef>(value: I) => T;
|
|
|
282
289
|
* Creates a {@link FindBestIndexMatchFunction} from a set of IndexRef items.
|
|
283
290
|
* Given an input index, returns the item with the highest index that is less than or equal to the input.
|
|
284
291
|
*
|
|
285
|
-
* @param items -
|
|
286
|
-
* @returns
|
|
287
|
-
* @throws {Error} When the input iterable is empty
|
|
292
|
+
* @param items - The available match options; must not be empty.
|
|
293
|
+
* @returns Finds the best match for any input index.
|
|
294
|
+
* @throws {Error} When the input iterable is empty.
|
|
295
|
+
*
|
|
296
|
+
* @dbxUtil
|
|
297
|
+
* @dbxUtilCategory value
|
|
298
|
+
* @dbxUtilKind factory
|
|
299
|
+
* @dbxUtilTags value, index, match, find, factory, lookup
|
|
300
|
+
* @dbxUtilRelated find-best-index-match, safe-find-best-index-match
|
|
288
301
|
*
|
|
289
302
|
* @example
|
|
290
303
|
* ```ts
|
|
@@ -296,12 +309,6 @@ export type FindBestIndexMatchFunction<T> = <I extends IndexRef>(value: I) => T;
|
|
|
296
309
|
* fn({ i: 11 }); // returns { i: 10 }
|
|
297
310
|
* ```
|
|
298
311
|
*
|
|
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
312
|
* @__NO_SIDE_EFFECTS__
|
|
306
313
|
*/
|
|
307
314
|
export declare function findBestIndexMatchFunction<T extends IndexRef>(items: Iterable<T>): FindBestIndexMatchFunction<T>;
|
|
@@ -309,18 +316,18 @@ export declare function findBestIndexMatchFunction<T extends IndexRef>(items: It
|
|
|
309
316
|
* Finds the best match for the given index from the input array.
|
|
310
317
|
* Returns the item with the highest index that is less than or equal to `i`.
|
|
311
318
|
*
|
|
312
|
-
* @param input -
|
|
313
|
-
* @param i -
|
|
314
|
-
* @returns
|
|
315
|
-
* @throws {Error} When the input array is empty
|
|
319
|
+
* @param input - The available match options.
|
|
320
|
+
* @param i - The target index to match against.
|
|
321
|
+
* @returns The best matching item.
|
|
322
|
+
* @throws {Error} When the input array is empty.
|
|
316
323
|
*/
|
|
317
324
|
export declare function findBestIndexMatch<T extends IndexRef>(input: T[], i: IndexNumber): T;
|
|
318
325
|
/**
|
|
319
326
|
* Safe variant of {@link findBestIndexMatch} that returns undefined instead of throwing when input is empty or null.
|
|
320
327
|
*
|
|
321
|
-
* @param input -
|
|
322
|
-
* @param i -
|
|
323
|
-
* @returns
|
|
328
|
+
* @param input - The available match options, or null/undefined.
|
|
329
|
+
* @param i - The target index to match against.
|
|
330
|
+
* @returns The best matching item, or undefined if input is empty/null.
|
|
324
331
|
*/
|
|
325
332
|
export declare function safeFindBestIndexMatch<T extends IndexRef>(input: Maybe<T[]>, i: IndexNumber): Maybe<T>;
|
|
326
333
|
/**
|
|
@@ -349,14 +356,15 @@ export type ReadIndexRangeFunction<T> = FactoryWithRequiredInput<IndexRange, T>;
|
|
|
349
356
|
* Creates a SortCompareFunction that sorts items by their IndexRange in ascending order.
|
|
350
357
|
* Sorts by minIndex first, then by maxIndex for items with equal minIndex values.
|
|
351
358
|
*
|
|
359
|
+
* @param readIndexRange - Extracts the IndexRange from each item.
|
|
360
|
+
* @returns A compare function suitable for Array.sort()
|
|
361
|
+
*
|
|
352
362
|
* @dbxUtil
|
|
353
363
|
* @dbxUtilCategory value
|
|
354
364
|
* @dbxUtilKind factory
|
|
355
365
|
* @dbxUtilTags value, index-range, sort, ascending, factory, compare
|
|
356
366
|
* @dbxUtilRelated sort-by-index-ascending-compare-function, index-range-reader-pair-factory
|
|
357
367
|
*
|
|
358
|
-
* @param readIndexRange - extracts the IndexRange from each item
|
|
359
|
-
* @returns a compare function suitable for Array.sort()
|
|
360
368
|
* @__NO_SIDE_EFFECTS__
|
|
361
369
|
*/
|
|
362
370
|
export declare function sortByIndexRangeAscendingCompareFunction<T>(readIndexRange: ReadIndexRangeFunction<T>): SortCompareFunction<T>;
|
|
@@ -374,14 +382,15 @@ export type IndexRangeReaderPairFactory<T> = FactoryWithRequiredInput<IndexRange
|
|
|
374
382
|
/**
|
|
375
383
|
* Creates a new {@link IndexRangeReaderPairFactory} that pairs each value with its computed IndexRange.
|
|
376
384
|
*
|
|
385
|
+
* @param reader - Reads the IndexRange from the input value.
|
|
386
|
+
* @returns A factory that creates IndexRangeReaderPair instances.
|
|
387
|
+
*
|
|
377
388
|
* @dbxUtil
|
|
378
389
|
* @dbxUtilCategory value
|
|
379
390
|
* @dbxUtilKind factory
|
|
380
391
|
* @dbxUtilTags value, index-range, pair, factory, reader
|
|
381
392
|
* @dbxUtilRelated sort-by-index-range-ascending-compare-function
|
|
382
393
|
*
|
|
383
|
-
* @param reader - reads the IndexRange from the input value
|
|
384
|
-
* @returns a factory that creates IndexRangeReaderPair instances
|
|
385
394
|
* @__NO_SIDE_EFFECTS__
|
|
386
395
|
*/
|
|
387
396
|
export declare function indexRangeReaderPairFactory<T>(reader: ReadIndexRangeFunction<T>): IndexRangeReaderPairFactory<T>;
|
|
@@ -394,8 +403,8 @@ export type IndexRangeInput = IndexNumber | IndexRange;
|
|
|
394
403
|
* Normalizes an {@link IndexRangeInput} to a full {@link IndexRange}. When given a single number,
|
|
395
404
|
* creates a range spanning that single index (minIndex = input, maxIndex = input + 1).
|
|
396
405
|
*
|
|
397
|
-
* @param input -
|
|
398
|
-
* @returns
|
|
406
|
+
* @param input - A single index number or an IndexRange.
|
|
407
|
+
* @returns The normalized IndexRange.
|
|
399
408
|
*/
|
|
400
409
|
export declare function indexRange(input: IndexRangeInput): IndexRange;
|
|
401
410
|
/**
|
|
@@ -405,14 +414,15 @@ export type FitToIndexRangeFunction = (input: IndexNumber) => IndexNumber;
|
|
|
405
414
|
/**
|
|
406
415
|
* Creates a {@link FitToIndexRangeFunction} that clamps index numbers to the given range boundaries.
|
|
407
416
|
*
|
|
417
|
+
* @param input - The range to clamp to.
|
|
418
|
+
* @returns Clamps any index to the range.
|
|
419
|
+
*
|
|
408
420
|
* @dbxUtil
|
|
409
421
|
* @dbxUtilCategory value
|
|
410
422
|
* @dbxUtilKind factory
|
|
411
423
|
* @dbxUtilTags value, index, clamp, range, factory, fit
|
|
412
424
|
* @dbxUtilRelated wrap-index-range-function, bound-number-function
|
|
413
425
|
*
|
|
414
|
-
* @param input - the range to clamp to
|
|
415
|
-
* @returns a function that clamps any index to the range
|
|
416
426
|
* @__NO_SIDE_EFFECTS__
|
|
417
427
|
*/
|
|
418
428
|
export declare function fitToIndexRangeFunction(input: IndexRange): FitToIndexRangeFunction;
|
|
@@ -424,9 +434,9 @@ export type WrapIndexNumberFunction = WrapNumberFunction;
|
|
|
424
434
|
* Creates a {@link WrapIndexNumberFunction} that wraps index numbers around the range boundaries,
|
|
425
435
|
* similar to modular arithmetic. Values that exceed the max wrap to the min side and vice versa.
|
|
426
436
|
*
|
|
427
|
-
* @param input -
|
|
428
|
-
* @param fencePosts -
|
|
429
|
-
* @returns
|
|
437
|
+
* @param input - The index range to wrap within.
|
|
438
|
+
* @param fencePosts - Whether to use fencepost semantics (maxIndex is exclusive); defaults to true.
|
|
439
|
+
* @returns Wraps any index into the range.
|
|
430
440
|
*
|
|
431
441
|
* @dbxUtil
|
|
432
442
|
* @dbxUtilCategory value
|
|
@@ -440,6 +450,7 @@ export type WrapIndexNumberFunction = WrapNumberFunction;
|
|
|
440
450
|
* wrap(6); // 0 (wraps from positive side)
|
|
441
451
|
* wrap(-1); // 5 (wraps from negative side)
|
|
442
452
|
* ```
|
|
453
|
+
*
|
|
443
454
|
* @__NO_SIDE_EFFECTS__
|
|
444
455
|
*/
|
|
445
456
|
export declare function wrapIndexRangeFunction(input: IndexRange, fencePosts?: boolean): WrapIndexNumberFunction;
|
|
@@ -493,22 +504,23 @@ export type IndexRangeFunctionInput = IndexRange | IndexRangeFunctionConfig;
|
|
|
493
504
|
* Normalizes an {@link IndexRangeFunctionInput} to a full {@link IndexRangeFunctionConfig},
|
|
494
505
|
* defaulting `inclusiveMaxIndex` to false when a plain IndexRange is provided.
|
|
495
506
|
*
|
|
496
|
-
* @param input -
|
|
497
|
-
* @returns
|
|
507
|
+
* @param input - The range or config to normalize.
|
|
508
|
+
* @returns The normalized config.
|
|
498
509
|
*/
|
|
499
510
|
export declare function asIndexRangeCheckFunctionConfig(input: IndexRangeFunctionInput): IndexRangeFunctionConfig;
|
|
500
511
|
/**
|
|
501
512
|
* Creates an {@link IndexRangeCheckFunction} that tests whether an index number falls within the configured range.
|
|
502
513
|
* The min is inclusive and the max is exclusive by default unless `inclusiveMaxIndex` is set.
|
|
503
514
|
*
|
|
515
|
+
* @param input - The range or range config to check against.
|
|
516
|
+
* @returns A predicate function for index numbers.
|
|
517
|
+
*
|
|
504
518
|
* @dbxUtil
|
|
505
519
|
* @dbxUtilCategory value
|
|
506
520
|
* @dbxUtilKind factory
|
|
507
521
|
* @dbxUtilTags value, index, range, check, factory, predicate
|
|
508
522
|
* @dbxUtilRelated index-range-check-reader-function, is-index-number-in-index-range-function
|
|
509
523
|
*
|
|
510
|
-
* @param input - the range or range config to check against
|
|
511
|
-
* @returns a predicate function for index numbers
|
|
512
524
|
* @__NO_SIDE_EFFECTS__
|
|
513
525
|
*/
|
|
514
526
|
export declare function indexRangeCheckFunction(input: IndexRangeFunctionInput): IndexRangeCheckFunction;
|
|
@@ -519,23 +531,24 @@ export type IsIndexNumberInIndexRangeFunction = (index: IndexNumber) => boolean;
|
|
|
519
531
|
/**
|
|
520
532
|
* Checks whether a single index number falls within the given IndexRange.
|
|
521
533
|
*
|
|
522
|
-
* @param index -
|
|
523
|
-
* @param indexRange -
|
|
524
|
-
* @param inclusiveMaxIndex -
|
|
525
|
-
* @returns
|
|
534
|
+
* @param index - The index number to test.
|
|
535
|
+
* @param indexRange - The range to test against.
|
|
536
|
+
* @param inclusiveMaxIndex - Whether the max boundary is inclusive; defaults to false.
|
|
537
|
+
* @returns True if the index is within range.
|
|
526
538
|
*/
|
|
527
539
|
export declare function isIndexNumberInIndexRange(index: IndexNumber, indexRange: IndexRange, inclusiveMaxIndex?: boolean): boolean;
|
|
528
540
|
/**
|
|
529
541
|
* Creates an {@link IsIndexNumberInIndexRangeFunction} bound to the given range configuration.
|
|
530
542
|
*
|
|
543
|
+
* @param input - The range or range config to bind.
|
|
544
|
+
* @returns A predicate that tests index numbers against the bound range.
|
|
545
|
+
*
|
|
531
546
|
* @dbxUtil
|
|
532
547
|
* @dbxUtilCategory value
|
|
533
548
|
* @dbxUtilKind factory
|
|
534
549
|
* @dbxUtilTags value, index, range, check, factory, predicate
|
|
535
550
|
* @dbxUtilRelated is-index-number-in-index-range, index-range-check-function
|
|
536
551
|
*
|
|
537
|
-
* @param input - the range or range config to bind
|
|
538
|
-
* @returns a predicate that tests index numbers against the bound range
|
|
539
552
|
* @__NO_SIDE_EFFECTS__
|
|
540
553
|
*/
|
|
541
554
|
export declare function isIndexNumberInIndexRangeFunction(input: IndexRangeFunctionInput): IsIndexNumberInIndexRangeFunction;
|
|
@@ -546,22 +559,23 @@ export type IsIndexRangeInIndexRangeFunction = (indexRange: IndexRange) => boole
|
|
|
546
559
|
/**
|
|
547
560
|
* Checks whether `compareIndexRange` is entirely contained within `indexRange`.
|
|
548
561
|
*
|
|
549
|
-
* @param compareIndexRange -
|
|
550
|
-
* @param indexRange -
|
|
551
|
-
* @returns
|
|
562
|
+
* @param compareIndexRange - The range to test.
|
|
563
|
+
* @param indexRange - The bounding range.
|
|
564
|
+
* @returns True if the compare range is fully contained.
|
|
552
565
|
*/
|
|
553
566
|
export declare function isIndexRangeInIndexRange(compareIndexRange: IndexRange, indexRange: IndexRange): boolean;
|
|
554
567
|
/**
|
|
555
568
|
* Creates an {@link IsIndexRangeInIndexRangeFunction} bound to the given range configuration.
|
|
556
569
|
*
|
|
570
|
+
* @param input - The bounding range or range config to bind.
|
|
571
|
+
* @returns A predicate that tests whether index ranges are fully contained.
|
|
572
|
+
*
|
|
557
573
|
* @dbxUtil
|
|
558
574
|
* @dbxUtilCategory value
|
|
559
575
|
* @dbxUtilKind factory
|
|
560
576
|
* @dbxUtilTags value, index-range, contains, decision, factory, predicate
|
|
561
577
|
* @dbxUtilRelated is-index-range-in-index-range, index-range-overlaps-index-range-function
|
|
562
578
|
*
|
|
563
|
-
* @param input - the bounding range or range config to bind
|
|
564
|
-
* @returns a predicate that tests whether index ranges are fully contained
|
|
565
579
|
* @__NO_SIDE_EFFECTS__
|
|
566
580
|
*/
|
|
567
581
|
export declare function isIndexRangeInIndexRangeFunction(input: IndexRangeFunctionInput): IsIndexRangeInIndexRangeFunction;
|
|
@@ -572,30 +586,31 @@ export type IndexRangeOverlapsIndexRangeFunction = (indexRange: IndexRange) => b
|
|
|
572
586
|
/**
|
|
573
587
|
* Checks whether `compareIndexRange` overlaps `indexRange` in any way (partial or full).
|
|
574
588
|
*
|
|
575
|
-
* @param compareIndexRange -
|
|
576
|
-
* @param indexRange -
|
|
577
|
-
* @returns
|
|
589
|
+
* @param compareIndexRange - The range to test for overlap.
|
|
590
|
+
* @param indexRange - The reference range.
|
|
591
|
+
* @returns True if any portion of the ranges overlap.
|
|
578
592
|
*/
|
|
579
593
|
export declare function indexRangeOverlapsIndexRange(compareIndexRange: IndexRange, indexRange: IndexRange): boolean;
|
|
580
594
|
/**
|
|
581
595
|
* Creates an {@link IndexRangeOverlapsIndexRangeFunction} bound to the given range configuration.
|
|
582
596
|
*
|
|
597
|
+
* @param input - The reference range or range config to bind.
|
|
598
|
+
* @returns A predicate that tests for overlap with the bound range.
|
|
599
|
+
*
|
|
583
600
|
* @dbxUtil
|
|
584
601
|
* @dbxUtilCategory value
|
|
585
602
|
* @dbxUtilKind factory
|
|
586
603
|
* @dbxUtilTags value, index-range, overlap, decision, factory, predicate
|
|
587
604
|
* @dbxUtilRelated is-index-range-in-index-range-function, index-range-check-function
|
|
588
605
|
*
|
|
589
|
-
* @param input - the reference range or range config to bind
|
|
590
|
-
* @returns a predicate that tests for overlap with the bound range
|
|
591
606
|
* @__NO_SIDE_EFFECTS__
|
|
592
607
|
*/
|
|
593
608
|
export declare function indexRangeOverlapsIndexRangeFunction(input: IndexRangeFunctionInput): IndexRangeOverlapsIndexRangeFunction;
|
|
594
609
|
/**
|
|
595
610
|
* Returns an array of all IndexNumbers within the input IndexRange (minIndex inclusive, maxIndex exclusive).
|
|
596
611
|
*
|
|
597
|
-
* @param indexRange -
|
|
598
|
-
* @returns
|
|
612
|
+
* @param indexRange - The range to enumerate.
|
|
613
|
+
* @returns The sequential index numbers.
|
|
599
614
|
*/
|
|
600
615
|
export declare function allIndexesInIndexRange(indexRange: IndexRange): IndexNumber[];
|
|
601
616
|
/**
|
|
@@ -634,14 +649,15 @@ export type StepsFromIndexFunction = ((startIndex: number, wrapAround?: boolean,
|
|
|
634
649
|
* Creates a {@link StepsFromIndexFunction} that computes the next index after stepping from a start position.
|
|
635
650
|
* Returns undefined when the result falls outside the range (unless wrapping or fitting is enabled).
|
|
636
651
|
*
|
|
652
|
+
* @param config - Stepping behavior configuration.
|
|
653
|
+
* @returns Computes the stepped index.
|
|
654
|
+
*
|
|
637
655
|
* @dbxUtil
|
|
638
656
|
* @dbxUtilCategory value
|
|
639
657
|
* @dbxUtilKind factory
|
|
640
658
|
* @dbxUtilTags value, index, step, range, factory, wrap, navigation
|
|
641
659
|
* @dbxUtilRelated wrap-index-range-function, fit-to-index-range-function
|
|
642
660
|
*
|
|
643
|
-
* @param config - stepping behavior configuration
|
|
644
|
-
* @returns a function that computes the stepped index
|
|
645
661
|
* @__NO_SIDE_EFFECTS__
|
|
646
662
|
*/
|
|
647
663
|
export declare function stepsFromIndexFunction(config: StepsFromIndexFunctionConfig): StepsFromIndexFunction;
|
|
@@ -651,11 +667,11 @@ export declare function stepsFromIndexFunction(config: StepsFromIndexFunctionCon
|
|
|
651
667
|
* Start indexes outside the range return undefined. When `wrapAround` is true, out-of-bound results
|
|
652
668
|
* wrap to the other side of the range (e.g., stepping past maxIndex wraps to minIndex).
|
|
653
669
|
*
|
|
654
|
-
* @param range -
|
|
655
|
-
* @param startIndex -
|
|
656
|
-
* @param step -
|
|
657
|
-
* @param wrapAround -
|
|
658
|
-
* @returns
|
|
670
|
+
* @param range - The index range to step within.
|
|
671
|
+
* @param startIndex - The starting position.
|
|
672
|
+
* @param step - Number of steps to take (positive or negative); defaults to 1.
|
|
673
|
+
* @param wrapAround - Whether to wrap out-of-bound results; defaults to false.
|
|
674
|
+
* @returns The resulting index, or undefined if out of bounds without wrapping.
|
|
659
675
|
*/
|
|
660
676
|
export declare function stepsFromIndex(range: IndexRange, startIndex: number, step?: number, wrapAround?: boolean): Maybe<number>;
|
|
661
677
|
/**
|
package/src/lib/value/label.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export interface LabeledValue<T> extends LabelRef {
|
|
|
16
16
|
*
|
|
17
17
|
* Enables fast lookup of labeled items by their value key.
|
|
18
18
|
*
|
|
19
|
-
* @param values -
|
|
20
|
-
* @returns
|
|
19
|
+
* @param values - Array of labeled values to index.
|
|
20
|
+
* @returns Map keyed by each item's value for fast lookup.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
package/src/lib/value/map.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export type ReadValueFunction<I, O> = MapFunction<I, O>;
|
|
|
15
15
|
* Wraps a MapFunction so that null/undefined inputs are passed through without invoking the map,
|
|
16
16
|
* avoiding errors on nullable values.
|
|
17
17
|
*
|
|
18
|
-
* @param mapFunction -
|
|
19
|
-
* @returns
|
|
18
|
+
* @param mapFunction - Function to apply only when the input is defined.
|
|
19
|
+
* @returns A new function that short-circuits on null/undefined inputs.
|
|
20
20
|
*
|
|
21
21
|
* @dbxUtil
|
|
22
22
|
* @dbxUtilCategory value
|
|
@@ -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
|
+
*
|
|
36
37
|
* @__NO_SIDE_EFFECTS__
|
|
37
38
|
*/
|
|
38
39
|
export declare function mapMaybeFunction<I, O>(mapFunction: MapFunction<I, O>): MapFunction<Maybe<I>, Maybe<O>>;
|
|
@@ -59,14 +60,15 @@ export type ApplyMapFunctionWithOptions<I, O, C> = (input: I, target?: Maybe<Par
|
|
|
59
60
|
/**
|
|
60
61
|
* Lifts a per-element MapFunction into one that operates on arrays, applying the mapping to each element.
|
|
61
62
|
*
|
|
63
|
+
* @param mapFunction - Per-element transformation.
|
|
64
|
+
* @returns Maps entire arrays.
|
|
65
|
+
*
|
|
62
66
|
* @dbxUtil
|
|
63
67
|
* @dbxUtilCategory value
|
|
64
68
|
* @dbxUtilKind factory
|
|
65
69
|
* @dbxUtilTags map, transform, array, lift, factory
|
|
66
70
|
* @dbxUtilRelated map-maybe-function, chain-map-functions
|
|
67
71
|
*
|
|
68
|
-
* @param mapFunction - per-element transformation
|
|
69
|
-
* @returns a function that maps entire arrays
|
|
70
72
|
* @__NO_SIDE_EFFECTS__
|
|
71
73
|
*/
|
|
72
74
|
export declare function mapArrayFunction<I, O>(mapFunction: MapFunction<I, O>): MapArrayFunction<MapFunction<I, O>>;
|
|
@@ -89,25 +91,27 @@ export declare const MAP_IDENTITY: <T>(input: T) => T;
|
|
|
89
91
|
/**
|
|
90
92
|
* Returns the shared {@link MAP_IDENTITY} function cast to the requested type, useful for providing a typed no-op transformation.
|
|
91
93
|
*
|
|
94
|
+
* @returns The singleton identity function typed as `MapFunction<T, T>`
|
|
95
|
+
*
|
|
92
96
|
* @dbxUtil
|
|
93
97
|
* @dbxUtilCategory value
|
|
94
98
|
* @dbxUtilTags map, identity, no-op, typed
|
|
95
99
|
* @dbxUtilRelated map-identity, is-map-identity-function
|
|
96
100
|
*
|
|
97
|
-
* @returns the singleton identity function typed as `MapFunction<T, T>`
|
|
98
101
|
* @__NO_SIDE_EFFECTS__
|
|
99
102
|
*/
|
|
100
103
|
export declare function mapIdentityFunction<T>(): MapFunction<T, T>;
|
|
101
104
|
/**
|
|
102
105
|
* Checks whether the given function is the singleton {@link MAP_IDENTITY} reference.
|
|
103
106
|
*
|
|
107
|
+
* @param fn - The function to check.
|
|
108
|
+
* @returns `true` if the function is the identity singleton.
|
|
109
|
+
*
|
|
104
110
|
* @dbxUtil
|
|
105
111
|
* @dbxUtilCategory value
|
|
106
112
|
* @dbxUtilTags map, identity, type-guard, sentinel
|
|
107
113
|
* @dbxUtilRelated map-identity, map-identity-function
|
|
108
114
|
*
|
|
109
|
-
* @param fn - the function to check
|
|
110
|
-
* @returns `true` if the function is the identity singleton
|
|
111
115
|
* @__NO_SIDE_EFFECTS__
|
|
112
116
|
*/
|
|
113
117
|
export declare function isMapIdentityFunction(fn: unknown): fn is typeof MAP_IDENTITY;
|
|
@@ -121,8 +125,8 @@ export type MapFunctionOutputPair<O, I = unknown> = {
|
|
|
121
125
|
/**
|
|
122
126
|
* Wraps a MapFunction so that each invocation returns a {@link MapFunctionOutputPair} containing both the original input and the computed output.
|
|
123
127
|
*
|
|
124
|
-
* @param fn -
|
|
125
|
-
* @returns
|
|
128
|
+
* @param fn - The map function to wrap.
|
|
129
|
+
* @returns A new function that returns input/output pairs.
|
|
126
130
|
*/
|
|
127
131
|
export declare function mapFunctionOutputPair<O, I = unknown>(fn: MapFunction<I, O>): MapFunction<I, MapFunctionOutputPair<O, I>>;
|
|
128
132
|
/**
|
|
@@ -135,16 +139,16 @@ export type MapFunctionOutput<O extends object, I = unknown> = O & {
|
|
|
135
139
|
* Wraps a MapFunction so that its object output is augmented with a readonly `_input` property referencing the original input.
|
|
136
140
|
* Useful for retaining provenance through a transformation pipeline.
|
|
137
141
|
*
|
|
138
|
-
* @param fn -
|
|
139
|
-
* @returns
|
|
142
|
+
* @param fn - The map function whose output will be augmented.
|
|
143
|
+
* @returns A new function that returns a {@link MapFunctionOutput} with the `_input` reference attached.
|
|
140
144
|
*/
|
|
141
145
|
export declare function wrapMapFunctionOutput<O extends object, I = unknown>(fn: MapFunction<I, O>): MapFunction<I, MapFunctionOutput<O, I>>;
|
|
142
146
|
/**
|
|
143
147
|
* Attaches a readonly `_input` property to the given output object, creating a {@link MapFunctionOutput}.
|
|
144
148
|
*
|
|
145
|
-
* @param output -
|
|
146
|
-
* @param input -
|
|
147
|
-
* @returns
|
|
149
|
+
* @param output - The computed output object.
|
|
150
|
+
* @param input - The original input value to attach.
|
|
151
|
+
* @returns The output augmented with `_input`
|
|
148
152
|
*/
|
|
149
153
|
export declare function mapFunctionOutput<O extends object, I = unknown>(output: O, input: I): MapFunctionOutput<O, I>;
|
|
150
154
|
/**
|
|
@@ -152,8 +156,8 @@ export declare function mapFunctionOutput<O extends object, I = unknown>(output:
|
|
|
152
156
|
* Null/undefined entries and identity functions are automatically removed for efficiency.
|
|
153
157
|
* Returns the identity function if no meaningful functions remain.
|
|
154
158
|
*
|
|
155
|
-
* @param input -
|
|
156
|
-
* @returns
|
|
159
|
+
* @param input - One or more optional same-type map functions to chain.
|
|
160
|
+
* @returns A single composed function that runs all provided functions in order.
|
|
157
161
|
*
|
|
158
162
|
* @dbxUtil
|
|
159
163
|
* @dbxUtilCategory value
|