@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
|
@@ -47,13 +47,13 @@ export type StringOrGetter = GetterOrValue<string>;
|
|
|
47
47
|
/**
|
|
48
48
|
* Returns true if the input value is a non-class function (i.e., likely a Getter).
|
|
49
49
|
*
|
|
50
|
+
* @param value - The value to check.
|
|
51
|
+
* @returns True if the value is a non-class function.
|
|
52
|
+
*
|
|
50
53
|
* @dbxUtil
|
|
51
54
|
* @dbxUtilCategory getter
|
|
52
55
|
* @dbxUtilTags getter, type-guard, function, callable, check
|
|
53
56
|
* @dbxUtilRelated as-getter, get-value-from-getter
|
|
54
|
-
*
|
|
55
|
-
* @param value - The value to check
|
|
56
|
-
* @returns True if the value is a non-class function
|
|
57
57
|
*/
|
|
58
58
|
export declare function isGetter<T = unknown>(value: unknown): value is Getter<T>;
|
|
59
59
|
/**
|
|
@@ -75,13 +75,13 @@ export declare function getValueFromGetter<T extends GetterDistinctValue, A>(thi
|
|
|
75
75
|
/**
|
|
76
76
|
* Wraps the input as a Getter function. If it's already a function, returns it directly.
|
|
77
77
|
*
|
|
78
|
+
* @param input - A value or getter function.
|
|
79
|
+
* @returns A Getter function that returns the value.
|
|
80
|
+
*
|
|
78
81
|
* @dbxUtil
|
|
79
82
|
* @dbxUtilCategory getter
|
|
80
83
|
* @dbxUtilTags getter, factory, wrap, ensure, normalize
|
|
81
84
|
* @dbxUtilRelated get-value-from-getter, is-getter
|
|
82
|
-
*
|
|
83
|
-
* @param input - A value or getter function
|
|
84
|
-
* @returns A Getter function that returns the value
|
|
85
85
|
*/
|
|
86
86
|
export declare function asGetter<T>(input: GetterOrValue<T>): Getter<T>;
|
|
87
87
|
/**
|
|
@@ -91,15 +91,16 @@ export type ObjectCopyFactory<T> = Factory<T>;
|
|
|
91
91
|
/**
|
|
92
92
|
* Creates a factory that returns a shallow copy of the input value on each call.
|
|
93
93
|
*
|
|
94
|
+
* @param value - Source whose contents the factory should reproduce.
|
|
95
|
+
* @param copyFunction - Override for the per-call copy behavior; defaults to `copyObject`.
|
|
96
|
+
* @returns Stable producer that yields a fresh copy of `value` per invocation.
|
|
97
|
+
*
|
|
94
98
|
* @dbxUtil
|
|
95
99
|
* @dbxUtilCategory getter
|
|
96
100
|
* @dbxUtilKind factory
|
|
97
101
|
* @dbxUtilTags getter, factory, copy, clone, object
|
|
98
102
|
* @dbxUtilRelated as-object-copy-factory, copy-object
|
|
99
103
|
*
|
|
100
|
-
* @param value - The object to copy
|
|
101
|
-
* @param copyFunction - Optional custom copy function (defaults to copyObject)
|
|
102
|
-
* @returns A factory that produces copies of the value
|
|
103
104
|
* @__NO_SIDE_EFFECTS__
|
|
104
105
|
*/
|
|
105
106
|
export declare function objectCopyFactory<T extends object>(value: T, copyFunction?: CopyObjectFunction<T>): ObjectCopyFactory<T>;
|
|
@@ -107,29 +108,31 @@ export declare function objectCopyFactory<T extends object>(value: T, copyFuncti
|
|
|
107
108
|
* Converts the input to an ObjectCopyFactory. If the input is an object, wraps it with objectCopyFactory.
|
|
108
109
|
* If it's already a function (Getter), it's returned directly.
|
|
109
110
|
*
|
|
111
|
+
* @param input - An object value or a getter function.
|
|
112
|
+
* @param copyFunction - Optional custom copy function.
|
|
113
|
+
* @returns An ObjectCopyFactory for the input.
|
|
114
|
+
*
|
|
110
115
|
* @dbxUtil
|
|
111
116
|
* @dbxUtilCategory getter
|
|
112
117
|
* @dbxUtilKind factory
|
|
113
118
|
* @dbxUtilTags getter, factory, copy, clone, object, normalize
|
|
114
119
|
* @dbxUtilRelated object-copy-factory, as-getter
|
|
115
120
|
*
|
|
116
|
-
* @param input - An object value or a getter function
|
|
117
|
-
* @param copyFunction - Optional custom copy function
|
|
118
|
-
* @returns An ObjectCopyFactory for the input
|
|
119
121
|
* @__NO_SIDE_EFFECTS__
|
|
120
122
|
*/
|
|
121
123
|
export declare function asObjectCopyFactory<T>(input: T | ObjectCopyFactory<T>, copyFunction?: CopyObjectFunction<T>): ObjectCopyFactory<T>;
|
|
122
124
|
/**
|
|
123
125
|
* Wraps the input value in a Getter function that always returns it.
|
|
124
126
|
*
|
|
127
|
+
* @param input - The value to wrap.
|
|
128
|
+
* @returns A Getter that returns the input value.
|
|
129
|
+
*
|
|
125
130
|
* @dbxUtil
|
|
126
131
|
* @dbxUtilCategory getter
|
|
127
132
|
* @dbxUtilKind factory
|
|
128
133
|
* @dbxUtilTags getter, factory, wrap, constant
|
|
129
134
|
* @dbxUtilRelated as-getter, get-value-from-getter
|
|
130
135
|
*
|
|
131
|
-
* @param input - The value to wrap
|
|
132
|
-
* @returns A Getter that returns the input value
|
|
133
136
|
* @__NO_SIDE_EFFECTS__
|
|
134
137
|
*/
|
|
135
138
|
export declare function makeGetter<T>(input: T): Getter<T>;
|
|
@@ -140,14 +143,15 @@ export type FactoryWithIndex<T> = FactoryWithInput<T, number> | FactoryWithRequi
|
|
|
140
143
|
/**
|
|
141
144
|
* Calls a factory function the specified number of times and returns the results as an array.
|
|
142
145
|
*
|
|
146
|
+
* @param factory - Per-item producer invoked with the running index.
|
|
147
|
+
* @param count - Total number of items to materialize.
|
|
148
|
+
* @returns Materialized output collected from each `factory` call.
|
|
149
|
+
*
|
|
143
150
|
* @dbxUtil
|
|
144
151
|
* @dbxUtilCategory getter
|
|
145
152
|
* @dbxUtilTags getter, factory, generate, array, count
|
|
146
153
|
* @dbxUtilRelated make-with-factory-input, array-factory
|
|
147
154
|
*
|
|
148
|
-
* @param factory - The factory function to call (receives the current index as argument)
|
|
149
|
-
* @param count - The number of items to create
|
|
150
|
-
* @returns An array of produced values
|
|
151
155
|
* @__NO_SIDE_EFFECTS__
|
|
152
156
|
*/
|
|
153
157
|
export declare function makeWithFactory<T>(factory: Factory<T> | FactoryWithIndex<T>, count: number): T[];
|
|
@@ -170,14 +174,15 @@ export declare function makeWithFactoryInput<T, A>(factory: FactoryWithRequiredI
|
|
|
170
174
|
* Wraps a factory so that no arguments are forwarded when it's called.
|
|
171
175
|
* Useful for protecting a factory from accidentally receiving arguments.
|
|
172
176
|
*
|
|
177
|
+
* @param factory - The factory to wrap.
|
|
178
|
+
* @returns A new factory that calls the original with no arguments.
|
|
179
|
+
*
|
|
173
180
|
* @dbxUtil
|
|
174
181
|
* @dbxUtilCategory getter
|
|
175
182
|
* @dbxUtilKind factory
|
|
176
183
|
* @dbxUtilTags getter, factory, protect, wrap, no-args
|
|
177
184
|
* @dbxUtilRelated as-getter, make-getter
|
|
178
185
|
*
|
|
179
|
-
* @param factory - The factory to wrap
|
|
180
|
-
* @returns A new factory that calls the original with no arguments
|
|
181
186
|
* @__NO_SIDE_EFFECTS__
|
|
182
187
|
*/
|
|
183
188
|
export declare function protectedFactory<T>(factory: Factory<T>): Factory<T>;
|
|
@@ -7,22 +7,23 @@ export type MapGetterFactory<I, O> = (input: Getter<I>) => Getter<O>;
|
|
|
7
7
|
/**
|
|
8
8
|
* Creates a new Getter that applies a mapping function to the result of the input Getter.
|
|
9
9
|
*
|
|
10
|
-
* @param input - The source Getter
|
|
11
|
-
* @param mapFn - The mapping function to apply to the getter's value
|
|
12
|
-
* @returns A new Getter that returns the mapped value
|
|
10
|
+
* @param input - The source Getter.
|
|
11
|
+
* @param mapFn - The mapping function to apply to the getter's value.
|
|
12
|
+
* @returns A new Getter that returns the mapped value.
|
|
13
13
|
*/
|
|
14
14
|
export declare function mapGetter<I, O>(input: Getter<I>, mapFn: MapFunction<I, O>): Getter<O>;
|
|
15
15
|
/**
|
|
16
16
|
* Creates a factory that wraps Getters with a mapping function.
|
|
17
17
|
*
|
|
18
|
+
* @param mapFn - The mapping function to apply.
|
|
19
|
+
* @returns A factory that transforms Getters of type I to Getters of type O.
|
|
20
|
+
*
|
|
18
21
|
* @dbxUtil
|
|
19
22
|
* @dbxUtilCategory getter
|
|
20
23
|
* @dbxUtilKind factory
|
|
21
24
|
* @dbxUtilTags getter, map, transform, factory
|
|
22
25
|
* @dbxUtilRelated map-getter
|
|
23
26
|
*
|
|
24
|
-
* @param mapFn - The mapping function to apply
|
|
25
|
-
* @returns A factory that transforms Getters of type I to Getters of type O
|
|
26
27
|
* @__NO_SIDE_EFFECTS__
|
|
27
28
|
*/
|
|
28
29
|
export declare function mapGetterFactory<I, O>(mapFn: MapFunction<I, O>): MapGetterFactory<I, O>;
|
|
@@ -6,14 +6,15 @@ export type RandomFromArrayFactory<T> = Factory<T>;
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates a factory that returns a random element from the given array on each call.
|
|
8
8
|
*
|
|
9
|
+
* @param values - Candidate pool the factory picks from on each call.
|
|
10
|
+
* @returns Stable producer that yields a uniformly random pick from `values`.
|
|
11
|
+
*
|
|
9
12
|
* @dbxUtil
|
|
10
13
|
* @dbxUtilCategory getter
|
|
11
14
|
* @dbxUtilKind factory
|
|
12
15
|
* @dbxUtilTags getter, factory, random, array, sample
|
|
13
16
|
* @dbxUtilRelated random-number-factory, random-array-factory
|
|
14
17
|
*
|
|
15
|
-
* @param values - The array of values to randomly select from
|
|
16
|
-
* @returns A factory that returns a random element from the array
|
|
17
18
|
* @__NO_SIDE_EFFECTS__
|
|
18
19
|
*/
|
|
19
20
|
export declare function randomFromArrayFactory<T>(values: T[]): RandomFromArrayFactory<T>;
|
package/src/lib/grouping.d.ts
CHANGED
|
@@ -36,27 +36,27 @@ export interface ArrayContentsDifferentParams<T, K extends PrimativeKey = Primat
|
|
|
36
36
|
/**
|
|
37
37
|
* Extracts a unique key from each item for pairing items across arrays.
|
|
38
38
|
*/
|
|
39
|
-
groupKeyFn: ReadKeyFunction<T, K>;
|
|
39
|
+
readonly groupKeyFn: ReadKeyFunction<T, K>;
|
|
40
40
|
/**
|
|
41
41
|
* Compares two paired items for equality.
|
|
42
42
|
*/
|
|
43
|
-
isEqual: EqualityComparatorFunction<T>;
|
|
43
|
+
readonly isEqual: EqualityComparatorFunction<T>;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Configuration for RestoreOrderParams.
|
|
47
47
|
*/
|
|
48
48
|
export interface RestoreOrderParams<T, K extends number | string = number | string> {
|
|
49
|
-
readKey: ReadKeyFunction<T, K>;
|
|
49
|
+
readonly readKey: ReadKeyFunction<T, K>;
|
|
50
50
|
/**
|
|
51
51
|
* Optional function used to decide which value should be retained.
|
|
52
52
|
*/
|
|
53
|
-
chooseRetainedValue?: (values: T[]) => T;
|
|
53
|
+
readonly chooseRetainedValue?: (values: T[]) => T;
|
|
54
54
|
/**
|
|
55
55
|
* Whether or not new items should be excluded. If false, the new items are appended to the end of the result in the order they are accessed.
|
|
56
56
|
*
|
|
57
57
|
* By default this is false.
|
|
58
58
|
*/
|
|
59
|
-
excludeNewItems?: boolean;
|
|
59
|
+
readonly excludeNewItems?: boolean;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* An array batch that carries its zero-based batch index via {@link IndexRef}.
|
|
@@ -65,9 +65,9 @@ export type IndexedBatch<T> = T[] & Readonly<IndexRef>;
|
|
|
65
65
|
/**
|
|
66
66
|
* Splits the input array into batches of a maximum size. Each batch carries its zero-based index as `.i`.
|
|
67
67
|
*
|
|
68
|
-
* @param input -
|
|
69
|
-
* @param batchSize -
|
|
70
|
-
* @returns
|
|
68
|
+
* @param input - Source items to partition into consecutive runs.
|
|
69
|
+
* @param batchSize - Upper bound on items per batch.
|
|
70
|
+
* @returns Consecutive batches tagged with their zero-based index.
|
|
71
71
|
*
|
|
72
72
|
* @dbxUtil
|
|
73
73
|
* @dbxUtilCategory grouping
|
|
@@ -106,13 +106,13 @@ export interface BatchCalc extends BatchCount {
|
|
|
106
106
|
/**
|
|
107
107
|
* Calculates batch metrics (count, full batches, remainder) from a {@link BatchCount} configuration.
|
|
108
108
|
*
|
|
109
|
+
* @param input - The total items and items-per-batch configuration.
|
|
110
|
+
* @returns A {@link BatchCalc} with computed batch counts and remainder.
|
|
111
|
+
*
|
|
109
112
|
* @dbxUtil
|
|
110
113
|
* @dbxUtilCategory grouping
|
|
111
114
|
* @dbxUtilTags batch, calculate, count, remainder, math
|
|
112
115
|
* @dbxUtilRelated batch, item-count-for-batch-index
|
|
113
|
-
*
|
|
114
|
-
* @param input - The total items and items-per-batch configuration.
|
|
115
|
-
* @returns A {@link BatchCalc} with computed batch counts and remainder.
|
|
116
116
|
*/
|
|
117
117
|
export declare function batchCalc(input: BatchCount): BatchCalc;
|
|
118
118
|
/**
|
|
@@ -120,7 +120,7 @@ export declare function batchCalc(input: BatchCount): BatchCalc;
|
|
|
120
120
|
*
|
|
121
121
|
* @param index - Zero-based batch index.
|
|
122
122
|
* @param calc - Pre-computed batch calculation from {@link batchCalc}.
|
|
123
|
-
* @returns
|
|
123
|
+
* @returns Item count for the requested batch, accounting for a smaller trailing remainder.
|
|
124
124
|
*/
|
|
125
125
|
export declare function itemCountForBatchIndex(index: number, calc: BatchCalc): number;
|
|
126
126
|
/**
|
|
@@ -141,9 +141,9 @@ export declare function restoreOrderWithValues<T, K extends PrimativeKey = Prima
|
|
|
141
141
|
* @param orderKeys - Keys defining the desired order.
|
|
142
142
|
* @param values - Values to reorder.
|
|
143
143
|
* @param params - Configuration including key reader, duplicate handling, and new-item behavior.
|
|
144
|
-
* @param params.readKey -
|
|
145
|
-
* @param params.chooseRetainedValue -
|
|
146
|
-
* @param params.excludeNewItems -
|
|
144
|
+
* @param params.readKey - Function that extracts the grouping key from each value.
|
|
145
|
+
* @param params.chooseRetainedValue - Function that selects which value to keep when duplicates share the same key; defaults to keeping the first.
|
|
146
|
+
* @param params.excludeNewItems - When true, values whose keys are not in `orderKeys` are omitted from the result; defaults to false.
|
|
147
147
|
* @returns The reordered values array.
|
|
148
148
|
*
|
|
149
149
|
* @dbxUtil
|
|
@@ -167,8 +167,8 @@ export declare function restoreOrder<T, K extends PrimativeKey = PrimativeKey>(o
|
|
|
167
167
|
* @param a - First array to compare.
|
|
168
168
|
* @param b - Second array to compare.
|
|
169
169
|
* @param params - Key extraction and equality functions.
|
|
170
|
-
* @param params.groupKeyFn -
|
|
171
|
-
* @param params.isEqual -
|
|
170
|
+
* @param params.groupKeyFn - Function that extracts a grouping key from each element for pairing.
|
|
171
|
+
* @param params.isEqual - Predicate that returns true when two paired elements are considered equal.
|
|
172
172
|
* @returns `true` if the array contents differ.
|
|
173
173
|
*/
|
|
174
174
|
export declare function arrayContentsDiffer<T, K extends PrimativeKey = PrimativeKey>(a: T[] | undefined, b: T[] | undefined, { groupKeyFn, isEqual }: ArrayContentsDifferentParams<T, K>): boolean;
|
|
@@ -183,28 +183,29 @@ export declare function pairGroupValues<T, K extends PrimativeKey = PrimativeKey
|
|
|
183
183
|
/**
|
|
184
184
|
* Creates an array of `[key, value]` tuples by extracting a key from each value.
|
|
185
185
|
*
|
|
186
|
+
* @param values - Values to create key pairs from.
|
|
187
|
+
* @param keyFn - Extracts the key from each value.
|
|
188
|
+
* @returns Tuples pairing each derived key with its source value.
|
|
189
|
+
*
|
|
186
190
|
* @dbxUtil
|
|
187
191
|
* @dbxUtilCategory grouping
|
|
188
192
|
* @dbxUtilTags grouping, key, pairs, tuple, array
|
|
189
193
|
* @dbxUtilRelated group-values, make-values-group-map
|
|
190
194
|
*
|
|
191
|
-
* @param values - Values to create key pairs from.
|
|
192
|
-
* @param keyFn - Extracts the key from each value.
|
|
193
|
-
* @returns An array of `[key, value]` tuples.
|
|
194
195
|
* @__NO_SIDE_EFFECTS__
|
|
195
196
|
*/
|
|
196
197
|
export declare function makeKeyPairs<T, K extends string | number = string | number>(values: T[], keyFn: ReadKeyFunction<T, K>): [Maybe<K>, T][];
|
|
197
198
|
/**
|
|
198
199
|
* Separates values into included and excluded groups based on a decision function.
|
|
199
200
|
*
|
|
201
|
+
* @param values - Values to separate.
|
|
202
|
+
* @param checkInclusion - Returns `true` for values that should be included.
|
|
203
|
+
* @returns A {@link SeparateResult} with included and excluded arrays.
|
|
204
|
+
*
|
|
200
205
|
* @dbxUtil
|
|
201
206
|
* @dbxUtilCategory grouping
|
|
202
207
|
* @dbxUtilTags array, separate, partition, split, filter, group
|
|
203
208
|
* @dbxUtilRelated group-values, pair-group-values
|
|
204
|
-
*
|
|
205
|
-
* @param values - Values to separate.
|
|
206
|
-
* @param checkInclusion - Returns `true` for values that should be included.
|
|
207
|
-
* @returns A {@link SeparateResult} with included and excluded arrays.
|
|
208
209
|
*/
|
|
209
210
|
export declare function separateValues<T>(values: T[], checkInclusion: DecisionFunction<T>): SeparateResult<T>;
|
|
210
211
|
/**
|
package/src/lib/hash.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ export type HashDecodeMap<H extends string = string, V extends string = string>
|
|
|
16
16
|
/**
|
|
17
17
|
* Decodes a list of hashed string values using a provided list of potential original values and a hash function.
|
|
18
18
|
*
|
|
19
|
-
* @param hashedValues -
|
|
20
|
-
* @param decodeValues -
|
|
21
|
-
* @param hashFn -
|
|
22
|
-
* @returns
|
|
19
|
+
* @param hashedValues - Hashed inputs awaiting reverse lookup.
|
|
20
|
+
* @param decodeValues - Plaintext candidates that may match one of the hashes.
|
|
21
|
+
* @param hashFn - Deterministic hashing used to align the candidate set with the input hashes.
|
|
22
|
+
* @returns Plaintext recovered from `decodeValues`, dropping any hash that lacks a match.
|
|
23
23
|
*
|
|
24
24
|
* @dbxUtil
|
|
25
25
|
* @dbxUtilCategory hash
|
|
@@ -38,22 +38,23 @@ export declare function decodeHashedValues(hashedValues: string[], decodeValues:
|
|
|
38
38
|
* Creates a `HashDecodeMap` from a list of potential original string values and a hash function.
|
|
39
39
|
* The map's keys are the hashed versions of the `decodeValues`, and the values are the original `decodeValues`.
|
|
40
40
|
*
|
|
41
|
+
* @param decodeValues - Plaintext candidates whose hashes the map should index.
|
|
42
|
+
* @param hashFn - Deterministic hashing used to compute each key.
|
|
43
|
+
* @returns Hash-to-plaintext lookup ready for reverse decoding.
|
|
44
|
+
*
|
|
41
45
|
* @dbxUtil
|
|
42
46
|
* @dbxUtilCategory hash
|
|
43
47
|
* @dbxUtilTags hash, decode, map, lookup, reverse, factory
|
|
44
48
|
* @dbxUtilRelated decode-hashed-values, decode-hashed-values-with-decode-map
|
|
45
49
|
*
|
|
46
|
-
* @param decodeValues - An array of potential original string values.
|
|
47
|
-
* @param hashFn - A function that takes a string and returns its hashed representation.
|
|
48
|
-
* @returns A {@link HashDecodeMap} for decoding hashed values.
|
|
49
50
|
* @__NO_SIDE_EFFECTS__
|
|
50
51
|
*/
|
|
51
52
|
export declare function makeHashDecodeMap(decodeValues: string[], hashFn: (value: string) => string): HashDecodeMap;
|
|
52
53
|
/**
|
|
53
54
|
* Decodes a list of hashed string values using a pre-built `HashDecodeMap`.
|
|
54
55
|
*
|
|
55
|
-
* @param hashedValues -
|
|
56
|
-
* @param decodeMap -
|
|
57
|
-
* @returns
|
|
56
|
+
* @param hashedValues - Hashed inputs awaiting reverse lookup.
|
|
57
|
+
* @param decodeMap - Pre-built hash-to-plaintext lookup.
|
|
58
|
+
* @returns Plaintext recovered via `decodeMap`, dropping any hash missing from it.
|
|
58
59
|
*/
|
|
59
60
|
export declare function decodeHashedValuesWithDecodeMap(hashedValues: string[], decodeMap: HashDecodeMap): string[];
|
|
@@ -10,7 +10,7 @@ export type IterableOrValue<T> = T | Iterable<T>;
|
|
|
10
10
|
/**
|
|
11
11
|
* Converts an IterableOrValue to an Iterable. Non-iterable values are wrapped in an array.
|
|
12
12
|
*
|
|
13
|
-
* @param values - The value or iterable to convert
|
|
13
|
+
* @param values - The value or iterable to convert.
|
|
14
14
|
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
15
15
|
* @returns An Iterable containing the value(s)
|
|
16
16
|
*/
|
|
@@ -20,14 +20,14 @@ export declare function asIterable<T = unknown>(values: IterableOrValue<T>, trea
|
|
|
20
20
|
*
|
|
21
21
|
* By default treats strings as a non-iterable value, using the string as a single value.
|
|
22
22
|
*
|
|
23
|
+
* @param values - The value or iterable to convert.
|
|
24
|
+
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
25
|
+
* @returns An array containing the value(s)
|
|
26
|
+
*
|
|
23
27
|
* @dbxUtil
|
|
24
28
|
* @dbxUtilCategory iterable
|
|
25
29
|
* @dbxUtilTags iterable, array, convert, normalize, ensure
|
|
26
30
|
* @dbxUtilRelated iterable-to-set, iterable-to-map, as-iterable
|
|
27
|
-
*
|
|
28
|
-
* @param values - The value or iterable to convert
|
|
29
|
-
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
30
|
-
* @returns An array containing the value(s)
|
|
31
31
|
*/
|
|
32
32
|
export declare function iterableToArray<T = unknown>(values: IterableOrValue<T>, treatStringAsIterable?: boolean): T[];
|
|
33
33
|
/**
|
|
@@ -35,103 +35,103 @@ export declare function iterableToArray<T = unknown>(values: IterableOrValue<T>,
|
|
|
35
35
|
*
|
|
36
36
|
* By default treats strings as a non-iterable value, using the string as a single value.
|
|
37
37
|
*
|
|
38
|
+
* @param values - The value or iterable to convert.
|
|
39
|
+
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
40
|
+
* @returns Deduped membership view collected from `values`.
|
|
41
|
+
*
|
|
38
42
|
* @dbxUtil
|
|
39
43
|
* @dbxUtilCategory iterable
|
|
40
44
|
* @dbxUtilTags iterable, set, convert, normalize, unique, dedupe
|
|
41
45
|
* @dbxUtilRelated iterable-to-array, iterable-to-map
|
|
42
|
-
*
|
|
43
|
-
* @param values - The value or iterable to convert
|
|
44
|
-
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
45
|
-
* @returns A Set containing the value(s)
|
|
46
46
|
*/
|
|
47
47
|
export declare function iterableToSet<T = unknown>(values: IterableOrValue<T>, treatStringAsIterable?: boolean): Set<T>;
|
|
48
48
|
/**
|
|
49
49
|
* Converts an IterableOrValue to a Map using a key extraction function.
|
|
50
50
|
*
|
|
51
|
-
* @param values - The value or iterable to convert
|
|
52
|
-
* @param readKey - Function to extract the key from each value
|
|
53
|
-
* @returns
|
|
51
|
+
* @param values - The value or iterable to convert.
|
|
52
|
+
* @param readKey - Function to extract the key from each value.
|
|
53
|
+
* @returns Lookup keyed by `readKey` results; the last entry per key wins.
|
|
54
54
|
*/
|
|
55
55
|
export declare function iterableToMap<T, K extends PrimativeKey = PrimativeKey>(values: IterableOrValue<T>, readKey: ReadKeyFunction<T, K>): Map<Maybe<K>, T>;
|
|
56
56
|
/**
|
|
57
57
|
* Type guard that returns true if the input is an Iterable.
|
|
58
58
|
* By default, strings are not treated as iterable.
|
|
59
59
|
*
|
|
60
|
+
* @param values - The value to check.
|
|
61
|
+
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
62
|
+
* @returns True if the value is iterable.
|
|
63
|
+
*
|
|
60
64
|
* @dbxUtil
|
|
61
65
|
* @dbxUtilCategory iterable
|
|
62
66
|
* @dbxUtilTags iterable, type-guard, check, symbol-iterator
|
|
63
67
|
* @dbxUtilRelated is-empty-iterable, as-iterable
|
|
64
|
-
*
|
|
65
|
-
* @param values - The value to check
|
|
66
|
-
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
67
|
-
* @returns True if the value is iterable
|
|
68
68
|
*/
|
|
69
69
|
export declare function isIterable<T = unknown>(values: unknown, treatStringAsIterable?: boolean): values is Iterable<T>;
|
|
70
70
|
/**
|
|
71
71
|
* Returns true if the iterable has no values.
|
|
72
72
|
*
|
|
73
|
+
* @param values - The iterable to check.
|
|
74
|
+
* @returns True if the iterable is empty.
|
|
75
|
+
*
|
|
73
76
|
* @dbxUtil
|
|
74
77
|
* @dbxUtilCategory iterable
|
|
75
78
|
* @dbxUtilTags iterable, empty, check, length
|
|
76
79
|
* @dbxUtilRelated is-iterable, first-value-from-iterable
|
|
77
|
-
*
|
|
78
|
-
* @param values - The iterable to check
|
|
79
|
-
* @returns True if the iterable is empty
|
|
80
80
|
*/
|
|
81
81
|
export declare function isEmptyIterable<T = unknown>(values: Iterable<T>): boolean;
|
|
82
82
|
/**
|
|
83
83
|
* Returns the first value from the Iterable, or undefined if empty. Order is not guaranteed.
|
|
84
84
|
*
|
|
85
|
-
* @param values - The iterable to read from
|
|
86
|
-
* @returns The first value, or undefined if empty
|
|
85
|
+
* @param values - The iterable to read from.
|
|
86
|
+
* @returns The first value, or undefined if empty.
|
|
87
87
|
*/
|
|
88
88
|
export declare function firstValueFromIterable<T>(values: Iterable<T>): Maybe<T>;
|
|
89
89
|
/**
|
|
90
90
|
* Takes up to `count` items from the iterable. Order is not guaranteed.
|
|
91
91
|
*
|
|
92
|
-
* @param values -
|
|
93
|
-
* @param count -
|
|
94
|
-
* @returns
|
|
92
|
+
* @param values - Source iterable feeding the take operation.
|
|
93
|
+
* @param count - Upper bound on items to consume from the iterator.
|
|
94
|
+
* @returns Consumed items, capped at `count`.
|
|
95
95
|
*/
|
|
96
96
|
export declare function takeValuesFromIterable<T>(values: Iterable<T>, count: number): T[];
|
|
97
97
|
/**
|
|
98
98
|
* Iterates over iterable values, calling the function for each one.
|
|
99
99
|
*
|
|
100
|
-
* @param values - The iterable to iterate over
|
|
101
|
-
* @param fn - The function to call for each value
|
|
100
|
+
* @param values - The iterable to iterate over.
|
|
101
|
+
* @param fn - The function to call for each value.
|
|
102
102
|
*/
|
|
103
103
|
export declare function forEachInIterable<T>(values: Iterable<T>, fn: (value: T) => void): void;
|
|
104
104
|
/**
|
|
105
105
|
* Calls the function for each value if the input is iterable, or once with the value if it's a single value.
|
|
106
106
|
* Does nothing if the input is null/undefined.
|
|
107
107
|
*
|
|
108
|
-
* @param values - The value or iterable to process
|
|
109
|
-
* @param fn - The function to call for each value
|
|
108
|
+
* @param values - The value or iterable to process.
|
|
109
|
+
* @param fn - The function to call for each value.
|
|
110
110
|
* @param treatStringAsIterable - Whether to treat strings as iterable (defaults to false)
|
|
111
111
|
*/
|
|
112
112
|
export declare function useIterableOrValue<T>(values: Maybe<IterableOrValue<T>>, fn: (value: T) => void, treatStringAsIterable?: boolean): void;
|
|
113
113
|
/**
|
|
114
114
|
* Finds and returns the first value in the iterable that matches the decision function.
|
|
115
115
|
*
|
|
116
|
-
* @param values - The iterable to search
|
|
117
|
-
* @param fn - Decision function that returns true for the desired value
|
|
118
|
-
* @returns The first matching value, or undefined
|
|
116
|
+
* @param values - The iterable to search.
|
|
117
|
+
* @param fn - Decision function that returns true for the desired value.
|
|
118
|
+
* @returns The first matching value, or undefined.
|
|
119
119
|
*/
|
|
120
120
|
export declare function findInIterable<T>(values: Iterable<T>, fn: DecisionFunction<T>): Maybe<T>;
|
|
121
121
|
/**
|
|
122
122
|
* Returns true if any value in the iterable matches the decision function.
|
|
123
123
|
*
|
|
124
|
-
* @param values - The iterable to search
|
|
125
|
-
* @param fn - Decision function to test each value
|
|
126
|
-
* @returns True if at least one value matches
|
|
124
|
+
* @param values - The iterable to search.
|
|
125
|
+
* @param fn - Decision function to test each value.
|
|
126
|
+
* @returns True if at least one value matches.
|
|
127
127
|
*/
|
|
128
128
|
export declare function existsInIterable<T>(values: Iterable<T>, fn: DecisionFunction<T>): boolean;
|
|
129
129
|
/**
|
|
130
130
|
* Filters values from the iterable, keeping those that pass the decision function.
|
|
131
131
|
*
|
|
132
|
-
* @param values -
|
|
133
|
-
* @param fn -
|
|
134
|
-
* @returns
|
|
132
|
+
* @param values - Source iterable feeding the filter.
|
|
133
|
+
* @param fn - Predicate that decides whether each value flows through.
|
|
134
|
+
* @returns Items for which the predicate returned true, in iteration order.
|
|
135
135
|
*/
|
|
136
136
|
export declare function filterFromIterable<T>(values: Iterable<T>, fn: DecisionFunction<T>): T[];
|
|
137
137
|
/**
|
|
@@ -140,8 +140,8 @@ export declare function filterFromIterable<T>(values: Iterable<T>, fn: DecisionF
|
|
|
140
140
|
*
|
|
141
141
|
* Used to prevent functions from incorrectly treating a tuple as an array of values.
|
|
142
142
|
*
|
|
143
|
-
* @param input - The tuple or array of tuples to wrap
|
|
143
|
+
* @param input - The tuple or array of tuples to wrap.
|
|
144
144
|
* @returns An array containing the tuple(s)
|
|
145
|
-
* @throws Error
|
|
145
|
+
* @throws {Error} If input is not an array.
|
|
146
146
|
*/
|
|
147
147
|
export declare function wrapTuples<T>(input: IterableOrValue<T>): T[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Maps each value in an iterable through a function and returns the results as an array.
|
|
3
3
|
*
|
|
4
|
-
* @param values -
|
|
5
|
-
* @param fn -
|
|
6
|
-
* @returns
|
|
4
|
+
* @param values - Source items to feed through the mapper.
|
|
5
|
+
* @param fn - Per-element transform applied to every value.
|
|
6
|
+
* @returns Mapped results collected in iteration order.
|
|
7
7
|
*/
|
|
8
8
|
export declare function mapIterable<I, O>(values: Iterable<I>, fn: (value: I) => O): O[];
|
package/src/lib/key.d.ts
CHANGED
|
@@ -38,13 +38,7 @@ export type ReadKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunc
|
|
|
38
38
|
* filtering out null/undefined keys.
|
|
39
39
|
*
|
|
40
40
|
* @param readKey - Function that extracts one or more keys from a value.
|
|
41
|
-
* @returns
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* const fn = readKeysFunction<string>((x) => x);
|
|
46
|
-
* fn(['a', 'b', 'c']); // ['a', 'b', 'c']
|
|
47
|
-
* ```
|
|
41
|
+
* @returns Reusable extractor that normalizes single or batch input into a flat key list (nullish keys dropped).
|
|
48
42
|
*
|
|
49
43
|
* @dbxUtil
|
|
50
44
|
* @dbxUtilCategory value
|
|
@@ -52,6 +46,12 @@ export type ReadKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunc
|
|
|
52
46
|
* @dbxUtilTags key, read, factory, array, primitive
|
|
53
47
|
* @dbxUtilRelated read-keys-set-function
|
|
54
48
|
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const fn = readKeysFunction<string>((x) => x);
|
|
52
|
+
* fn(['a', 'b', 'c']); // ['a', 'b', 'c']
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
55
|
* @__NO_SIDE_EFFECTS__
|
|
56
56
|
*/
|
|
57
57
|
export declare function readKeysFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>): ReadKeysFunction<T, K>;
|
|
@@ -60,7 +60,7 @@ export declare function readKeysFunction<T, K extends PrimativeKey = PrimativeKe
|
|
|
60
60
|
*
|
|
61
61
|
* @param readKey - Function that extracts one or more keys from a value.
|
|
62
62
|
* @param values - Values to read keys from.
|
|
63
|
-
* @returns
|
|
63
|
+
* @returns Flat list of every key extracted from `values`.
|
|
64
64
|
*/
|
|
65
65
|
export declare function readKeysFrom<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>, values: T[]): K[];
|
|
66
66
|
/**
|
|
@@ -71,13 +71,7 @@ export type ReadKeysSetFunction<T, K extends PrimativeKey = PrimativeKey> = MapF
|
|
|
71
71
|
* Creates a {@link ReadKeysSetFunction} from a key-reading function. Like {@link readKeysFunction} but returns a Set, deduplicating keys.
|
|
72
72
|
*
|
|
73
73
|
* @param readKey - Function that extracts one or more keys from a value.
|
|
74
|
-
* @returns
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* const fn = readKeysSetFunction<string>((x) => x);
|
|
79
|
-
* fn(['a', 'b', 'a']); // Set { 'a', 'b' }
|
|
80
|
-
* ```
|
|
74
|
+
* @returns Reusable extractor that collects keys into a deduped Set.
|
|
81
75
|
*
|
|
82
76
|
* @dbxUtil
|
|
83
77
|
* @dbxUtilCategory value
|
|
@@ -85,6 +79,12 @@ export type ReadKeysSetFunction<T, K extends PrimativeKey = PrimativeKey> = MapF
|
|
|
85
79
|
* @dbxUtilTags key, read, set, factory, dedupe, primitive
|
|
86
80
|
* @dbxUtilRelated read-keys-function
|
|
87
81
|
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const fn = readKeysSetFunction<string>((x) => x);
|
|
85
|
+
* fn(['a', 'b', 'a']); // Set { 'a', 'b' }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
88
|
* @__NO_SIDE_EFFECTS__
|
|
89
89
|
*/
|
|
90
90
|
export declare function readKeysSetFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>): ReadKeysSetFunction<T, K>;
|
|
@@ -93,6 +93,6 @@ export declare function readKeysSetFunction<T, K extends PrimativeKey = Primativ
|
|
|
93
93
|
*
|
|
94
94
|
* @param readKey - Function that extracts one or more keys from a value.
|
|
95
95
|
* @param values - Values to read keys from.
|
|
96
|
-
* @returns
|
|
96
|
+
* @returns Deduped key collection drawn from `values`.
|
|
97
97
|
*/
|
|
98
98
|
export declare function readKeysSetFrom<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>, values: T[]): Set<K>;
|