@dereekb/util 13.11.2 → 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.
- package/eslint/index.cjs.default.js +1 -0
- package/eslint/index.cjs.js +607 -0
- package/eslint/index.cjs.mjs +2 -0
- package/eslint/index.d.ts +1 -0
- package/eslint/index.esm.js +603 -0
- package/eslint/package.json +23 -0
- package/eslint/src/index.d.ts +1 -0
- package/eslint/src/lib/comments.d.ts +54 -0
- package/eslint/src/lib/index.d.ts +3 -0
- package/eslint/src/lib/plugin.d.ts +18 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +42 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +54 -0
- package/fetch/package.json +2 -2
- package/index.cjs.js +1203 -23
- package/index.esm.js +1203 -23
- package/package.json +7 -1
- package/src/lib/array/array.factory.d.ts +2 -0
- package/src/lib/array/array.filter.d.ts +50 -17
- package/src/lib/array/array.find.d.ts +1 -0
- package/src/lib/array/array.index.d.ts +7 -0
- package/src/lib/array/array.indexed.d.ts +21 -0
- package/src/lib/array/array.make.d.ts +7 -0
- package/src/lib/array/array.random.d.ts +1 -0
- package/src/lib/array/array.unique.d.ts +3 -0
- package/src/lib/array/array.value.d.ts +7 -0
- package/src/lib/auth/auth.role.claims.d.ts +7 -0
- package/src/lib/boolean.d.ts +1 -0
- package/src/lib/contact/random.d.ts +14 -0
- package/src/lib/date/date.d.ts +6 -0
- package/src/lib/date/time.d.ts +7 -0
- package/src/lib/date/week.d.ts +7 -0
- package/src/lib/error/error.d.ts +7 -0
- package/src/lib/filter/filter.d.ts +7 -0
- package/src/lib/function/function.boolean.d.ts +7 -0
- package/src/lib/function/function.forward.d.ts +14 -0
- package/src/lib/getter/getter.cache.d.ts +7 -0
- package/src/lib/getter/getter.d.ts +34 -0
- package/src/lib/getter/getter.map.d.ts +7 -0
- package/src/lib/getter/getter.util.d.ts +7 -0
- package/src/lib/grouping.d.ts +8 -0
- package/src/lib/hash.d.ts +1 -0
- package/src/lib/key.d.ts +16 -0
- package/src/lib/map/map.key.d.ts +14 -0
- package/src/lib/model/id.batch.d.ts +7 -0
- package/src/lib/model/id.factory.d.ts +7 -0
- package/src/lib/model/model.conversion.d.ts +35 -0
- package/src/lib/model/model.copy.d.ts +7 -0
- package/src/lib/model/model.d.ts +19 -0
- package/src/lib/model/model.modify.d.ts +14 -0
- package/src/lib/nodejs/stream.d.ts +7 -0
- package/src/lib/number/bound.d.ts +3 -0
- package/src/lib/number/dollar.d.ts +7 -0
- package/src/lib/number/factory.d.ts +7 -0
- package/src/lib/number/random.d.ts +1 -0
- package/src/lib/number/round.d.ts +22 -0
- package/src/lib/number/sort.d.ts +7 -0
- package/src/lib/number/transform.d.ts +7 -0
- package/src/lib/object/object.array.delta.d.ts +7 -0
- package/src/lib/object/object.equal.d.ts +7 -0
- package/src/lib/object/object.filter.pojo.d.ts +87 -0
- package/src/lib/object/object.filter.tuple.d.ts +16 -0
- package/src/lib/object/object.key.d.ts +14 -0
- package/src/lib/object/object.map.d.ts +14 -0
- package/src/lib/path/path.d.ts +9 -0
- package/src/lib/promise/promise.d.ts +21 -0
- package/src/lib/promise/promise.factory.d.ts +7 -0
- package/src/lib/promise/promise.task.d.ts +7 -0
- package/src/lib/service/handler.config.d.ts +28 -0
- package/src/lib/service/handler.d.ts +14 -0
- package/src/lib/set/set.d.ts +21 -0
- package/src/lib/set/set.decision.d.ts +7 -0
- package/src/lib/set/set.delta.d.ts +7 -0
- package/src/lib/set/set.selection.d.ts +7 -0
- package/src/lib/sort.d.ts +8 -0
- package/src/lib/string/char.d.ts +7 -0
- package/src/lib/string/dencoder.d.ts +35 -0
- package/src/lib/string/factory.d.ts +22 -1
- package/src/lib/string/replace.d.ts +78 -0
- package/src/lib/string/search.d.ts +7 -0
- package/src/lib/string/sort.d.ts +7 -0
- package/src/lib/string/string.d.ts +1 -0
- package/src/lib/string/transform.d.ts +53 -0
- package/src/lib/string/tree.d.ts +7 -0
- package/src/lib/string/url.d.ts +7 -0
- package/src/lib/tree/tree.array.d.ts +1 -0
- package/src/lib/tree/tree.explore.d.ts +3 -0
- package/src/lib/type.d.ts +3 -2
- package/src/lib/value/bound.d.ts +28 -0
- package/src/lib/value/comparator.d.ts +16 -0
- package/src/lib/value/decision.d.ts +5 -0
- package/src/lib/value/equal.d.ts +2 -0
- package/src/lib/value/indexed.d.ts +127 -0
- package/src/lib/value/map.d.ts +22 -0
- package/src/lib/value/maybe.type.d.ts +2 -2
- package/src/lib/value/modifier.d.ts +13 -0
- package/src/lib/value/point.d.ts +56 -0
- package/src/lib/value/use.d.ts +37 -0
- package/src/lib/value/vector.d.ts +7 -0
- package/test/index.cjs.js +17 -4
- package/test/index.esm.js +17 -4
- package/test/package.json +2 -2
- package/test/src/lib/shared/shared.fail.d.ts +24 -5
package/src/lib/key.d.ts
CHANGED
|
@@ -45,6 +45,14 @@ export type ReadKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunc
|
|
|
45
45
|
* const fn = readKeysFunction<string>((x) => x);
|
|
46
46
|
* fn(['a', 'b', 'c']); // ['a', 'b', 'c']
|
|
47
47
|
* ```
|
|
48
|
+
*
|
|
49
|
+
* @dbxUtil
|
|
50
|
+
* @dbxUtilCategory value
|
|
51
|
+
* @dbxUtilKind factory
|
|
52
|
+
* @dbxUtilTags key, read, factory, array, primitive
|
|
53
|
+
* @dbxUtilRelated read-keys-set-function
|
|
54
|
+
*
|
|
55
|
+
* @__NO_SIDE_EFFECTS__
|
|
48
56
|
*/
|
|
49
57
|
export declare function readKeysFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>): ReadKeysFunction<T, K>;
|
|
50
58
|
/**
|
|
@@ -70,6 +78,14 @@ export type ReadKeysSetFunction<T, K extends PrimativeKey = PrimativeKey> = MapF
|
|
|
70
78
|
* const fn = readKeysSetFunction<string>((x) => x);
|
|
71
79
|
* fn(['a', 'b', 'a']); // Set { 'a', 'b' }
|
|
72
80
|
* ```
|
|
81
|
+
*
|
|
82
|
+
* @dbxUtil
|
|
83
|
+
* @dbxUtilCategory value
|
|
84
|
+
* @dbxUtilKind factory
|
|
85
|
+
* @dbxUtilTags key, read, set, factory, dedupe, primitive
|
|
86
|
+
* @dbxUtilRelated read-keys-function
|
|
87
|
+
*
|
|
88
|
+
* @__NO_SIDE_EFFECTS__
|
|
73
89
|
*/
|
|
74
90
|
export declare function readKeysSetFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>): ReadKeysSetFunction<T, K>;
|
|
75
91
|
/**
|
package/src/lib/map/map.key.d.ts
CHANGED
|
@@ -10,8 +10,15 @@ export type KeyValueMapFactory<T, K extends PrimativeKey = PrimativeKey> = (valu
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a KeyValueMapFactory that maps values by their key using a ReadKeyFunction.
|
|
12
12
|
*
|
|
13
|
+
* @dbxUtil
|
|
14
|
+
* @dbxUtilCategory value
|
|
15
|
+
* @dbxUtilKind factory
|
|
16
|
+
* @dbxUtilTags map, key, factory, lookup, index
|
|
17
|
+
* @dbxUtilRelated multi-key-value-map-factory, read-keys-to-map
|
|
18
|
+
*
|
|
13
19
|
* @param read - Function that extracts a key from each value
|
|
14
20
|
* @returns A factory that creates Maps from arrays of values
|
|
21
|
+
* @__NO_SIDE_EFFECTS__
|
|
15
22
|
*/
|
|
16
23
|
export declare function keyValueMapFactory<T, K extends PrimativeKey = PrimativeKey>(read: ReadKeyFunction<T, K>): KeyValueMapFactory<T, K>;
|
|
17
24
|
/**
|
|
@@ -26,8 +33,15 @@ export declare function readKeysToMap<T, K extends PrimativeKey = PrimativeKey>(
|
|
|
26
33
|
* Creates a KeyValueMapFactory that maps values by multiple keys using a ReadMultipleKeysFunction.
|
|
27
34
|
* Each value can appear under multiple keys.
|
|
28
35
|
*
|
|
36
|
+
* @dbxUtil
|
|
37
|
+
* @dbxUtilCategory value
|
|
38
|
+
* @dbxUtilKind factory
|
|
39
|
+
* @dbxUtilTags map, key, multi, factory, lookup, index
|
|
40
|
+
* @dbxUtilRelated key-value-map-factory, read-multiple-keys-to-map
|
|
41
|
+
*
|
|
29
42
|
* @param read - Function that extracts multiple keys from each value
|
|
30
43
|
* @returns A factory that creates Maps from arrays of values
|
|
44
|
+
* @__NO_SIDE_EFFECTS__
|
|
31
45
|
*/
|
|
32
46
|
export declare function multiKeyValueMapFactory<T, K extends PrimativeKey = PrimativeKey>(read: ReadMultipleKeysFunction<T, K>): KeyValueMapFactory<T, K>;
|
|
33
47
|
/**
|
|
@@ -34,8 +34,15 @@ export type IdBatchFactory<T> = AsyncArrayFactory<T>;
|
|
|
34
34
|
* The factory generates identifiers in batches, filters them for uniqueness, and verifies each batch
|
|
35
35
|
* using the configured verifier. Throws if uniqueness generation fails repeatedly (after 20 attempts).
|
|
36
36
|
*
|
|
37
|
+
* @dbxUtil
|
|
38
|
+
* @dbxUtilCategory model
|
|
39
|
+
* @dbxUtilKind factory
|
|
40
|
+
* @dbxUtilTags model, id, batch, factory, async, unique, identifier
|
|
41
|
+
* @dbxUtilRelated sequential-incrementing-number-string-model-id-factory
|
|
42
|
+
*
|
|
37
43
|
* @param config - Configuration with the base factory for generating candidates and the verifier for validating them
|
|
38
44
|
* @returns An async factory function that produces the requested number of valid identifiers
|
|
39
45
|
* @throws Error if the factory cannot produce enough unique values after repeated attempts
|
|
46
|
+
* @__NO_SIDE_EFFECTS__
|
|
40
47
|
*/
|
|
41
48
|
export declare function idBatchFactory<T, K extends PrimativeKey = PrimativeKey>(config: IdBatchFactoryConfig<T, K>): IdBatchFactory<T>;
|
|
@@ -45,11 +45,18 @@ export interface SequentialIncrementingNumberStringModelIdFactoryConfig {
|
|
|
45
45
|
* @returns A factory function that returns the next encoded string identifier on each call
|
|
46
46
|
* @throws Error if `increaseBy` is 0
|
|
47
47
|
*
|
|
48
|
+
* @dbxUtil
|
|
49
|
+
* @dbxUtilCategory model
|
|
50
|
+
* @dbxUtilKind factory
|
|
51
|
+
* @dbxUtilTags model, id, factory, sequential, incrementing, dencoder
|
|
52
|
+
* @dbxUtilRelated id-batch-factory, number-string-dencoder-function
|
|
53
|
+
*
|
|
48
54
|
* @example
|
|
49
55
|
* ```ts
|
|
50
56
|
* const factory = sequentialIncrementingNumberStringModelIdFactory({ startAt: 0 });
|
|
51
57
|
* const first = factory(); // encoded representation of 0
|
|
52
58
|
* const second = factory(); // encoded representation of 1
|
|
53
59
|
* ```
|
|
60
|
+
* @__NO_SIDE_EFFECTS__
|
|
54
61
|
*/
|
|
55
62
|
export declare function sequentialIncrementingNumberStringModelIdFactory(config?: SequentialIncrementingNumberStringModelIdFactoryConfig): ModelIdFactory;
|
|
@@ -20,8 +20,15 @@ export interface ModelMapFunctions<V extends object, D extends object> {
|
|
|
20
20
|
*
|
|
21
21
|
* The `to` function converts from the model (V) to data (D), while `from` converts back from data (D) to model (V).
|
|
22
22
|
*
|
|
23
|
+
* @dbxUtil
|
|
24
|
+
* @dbxUtilCategory model
|
|
25
|
+
* @dbxUtilKind factory
|
|
26
|
+
* @dbxUtilTags model, conversion, map, factory, bidirectional, fields
|
|
27
|
+
* @dbxUtilRelated to-model-map-functions, modify-model-map-functions, model-field-conversions
|
|
28
|
+
*
|
|
23
29
|
* @param fields - Field conversion definitions for each key in the model
|
|
24
30
|
* @returns Object with `from` and `to` mapping functions
|
|
31
|
+
* @__NO_SIDE_EFFECTS__
|
|
25
32
|
*/
|
|
26
33
|
export declare function makeModelMapFunctions<V extends object, D extends object>(fields: ModelFieldConversions<V, D>): ModelMapFunctions<V, D>;
|
|
27
34
|
export type ModelConversionFieldTuple<I extends object> = [keyof I, ModelFieldMapFunction<unknown, unknown>];
|
|
@@ -45,8 +52,15 @@ export type ModelConversionFieldValuesFunction<I extends object, O extends objec
|
|
|
45
52
|
*
|
|
46
53
|
* Supports optional filtering by field names and skipping undefined values via {@link ModelConversionOptions}.
|
|
47
54
|
*
|
|
55
|
+
* @dbxUtil
|
|
56
|
+
* @dbxUtilCategory model
|
|
57
|
+
* @dbxUtilKind factory
|
|
58
|
+
* @dbxUtilTags model, conversion, factory, fields, map, transform
|
|
59
|
+
* @dbxUtilRelated make-model-map-functions, model-field-map-functions
|
|
60
|
+
*
|
|
48
61
|
* @param fields - Array of `[key, convertFn]` tuples defining how each field is converted
|
|
49
62
|
* @returns A function that converts an input object to an output object
|
|
63
|
+
* @__NO_SIDE_EFFECTS__
|
|
50
64
|
*/
|
|
51
65
|
export declare function makeModelConversionFieldValuesFunction<I extends object, O extends object>(fields: ModelConversionFieldValuesConfig<I>): ModelConversionFieldValuesFunction<I, O>;
|
|
52
66
|
/**
|
|
@@ -83,8 +97,15 @@ export type ModelFieldMapFunctionsWithDefaultsConfig<I = unknown, O = unknown> =
|
|
|
83
97
|
/**
|
|
84
98
|
* Compiles a {@link ModelFieldMapFunctionsConfig} into resolved {@link ModelFieldMapFunctions} with `from` and `to` mapping functions.
|
|
85
99
|
*
|
|
100
|
+
* @dbxUtil
|
|
101
|
+
* @dbxUtilCategory model
|
|
102
|
+
* @dbxUtilKind factory
|
|
103
|
+
* @dbxUtilTags model, field, map, factory, conversion, bidirectional
|
|
104
|
+
* @dbxUtilRelated model-field-map-function, make-model-map-functions
|
|
105
|
+
*
|
|
86
106
|
* @param config - Configuration with `from` and `to` field map configs
|
|
87
107
|
* @returns Compiled field map functions
|
|
108
|
+
* @__NO_SIDE_EFFECTS__
|
|
88
109
|
*/
|
|
89
110
|
export declare function modelFieldMapFunctions<I = unknown, O = unknown>(config: ModelFieldMapFunctionsConfig<I, O>): ModelFieldMapFunctions<I, O>;
|
|
90
111
|
/**
|
|
@@ -126,8 +147,15 @@ export type ModelFieldMapToFunction<I, O> = ModelFieldMapFunction<I, O>;
|
|
|
126
147
|
* - Null/undefined input with `convertMaybe`: delegates to that function
|
|
127
148
|
* - Null/undefined input with `default` or `defaultInput`: uses the appropriate fallback
|
|
128
149
|
*
|
|
150
|
+
* @dbxUtil
|
|
151
|
+
* @dbxUtilCategory model
|
|
152
|
+
* @dbxUtilKind factory
|
|
153
|
+
* @dbxUtilTags model, field, map, factory, maybe, default, convert
|
|
154
|
+
* @dbxUtilRelated model-field-map-functions, make-model-map-functions
|
|
155
|
+
*
|
|
129
156
|
* @param config - Configuration specifying how to convert values and handle null/undefined
|
|
130
157
|
* @returns A function that maps Maybe input values to output values
|
|
158
|
+
* @__NO_SIDE_EFFECTS__
|
|
131
159
|
*/
|
|
132
160
|
export declare function modelFieldMapFunction<I, O>(config: ModelFieldMapConfig<I, O>): ModelFieldMapFunction<I, O>;
|
|
133
161
|
export type ModelFieldConversionsConfigRef<T extends object, O extends object> = {
|
|
@@ -155,7 +183,14 @@ export type ToModelMapFunctionsInput<T extends object, O extends object> = ToMod
|
|
|
155
183
|
*
|
|
156
184
|
* Accepts a pre-built `mapFunctions` reference, a `fieldConversions` ref, or a `fields` config.
|
|
157
185
|
*
|
|
186
|
+
* @dbxUtil
|
|
187
|
+
* @dbxUtilCategory model
|
|
188
|
+
* @dbxUtilKind factory
|
|
189
|
+
* @dbxUtilTags model, conversion, map, factory, normalize, resolve
|
|
190
|
+
* @dbxUtilRelated make-model-map-functions, to-model-field-conversions
|
|
191
|
+
*
|
|
158
192
|
* @param input - Input that can be resolved to model map functions
|
|
159
193
|
* @returns Bidirectional model map functions
|
|
194
|
+
* @__NO_SIDE_EFFECTS__
|
|
160
195
|
*/
|
|
161
196
|
export declare function toModelMapFunctions<T extends object, O extends object>(input: ToModelMapFunctionsInput<T, O>): ModelMapFunctions<T, O>;
|
|
@@ -20,8 +20,15 @@ export type CopyModelFieldFunction<T> = (from: Partial<T>, target: Partial<T>) =
|
|
|
20
20
|
* If the field does not exist on the source but a default is configured, the default is used.
|
|
21
21
|
* Otherwise, the target is left unchanged.
|
|
22
22
|
*
|
|
23
|
+
* @dbxUtil
|
|
24
|
+
* @dbxUtilCategory model
|
|
25
|
+
* @dbxUtilKind factory
|
|
26
|
+
* @dbxUtilTags model, copy, field, factory, default
|
|
27
|
+
* @dbxUtilRelated make-model-map-functions, modify-model-map-functions
|
|
28
|
+
*
|
|
23
29
|
* @param key - The property key to copy
|
|
24
30
|
* @param inputConfig - Optional config with a default value for the field
|
|
25
31
|
* @returns A function that copies the field from source to target
|
|
32
|
+
* @__NO_SIDE_EFFECTS__
|
|
26
33
|
*/
|
|
27
34
|
export declare function makeCopyModelFieldFunction<T extends object>(key: keyof T, inputConfig?: Maybe<CopyModelFieldConfig>): CopyModelFieldFunction<T>;
|
package/src/lib/model/model.d.ts
CHANGED
|
@@ -155,9 +155,15 @@ export declare function removeModelsWithKey<T>(input: T[], key: Maybe<ModelKey>,
|
|
|
155
155
|
*
|
|
156
156
|
* If multiple models share the same key, the last one wins.
|
|
157
157
|
*
|
|
158
|
+
* @dbxUtil
|
|
159
|
+
* @dbxUtilCategory model
|
|
160
|
+
* @dbxUtilTags model, map, key, index, lookup
|
|
161
|
+
* @dbxUtilRelated make-multi-model-key-map, read-model-key
|
|
162
|
+
*
|
|
158
163
|
* @param input - Array of models to index
|
|
159
164
|
* @param read - Function to extract the key from each model; defaults to reading the `id` property
|
|
160
165
|
* @returns Map from model key to model
|
|
166
|
+
* @__NO_SIDE_EFFECTS__
|
|
161
167
|
*/
|
|
162
168
|
export declare function makeModelMap<T extends UniqueModel>(input: T[], read?: ReadModelKeyFunction<T>): Map<Maybe<ModelKey>, T>;
|
|
163
169
|
export declare function makeModelMap<T>(input: T[], read: ReadModelKeyFunction<T>): Map<Maybe<ModelKey>, T>;
|
|
@@ -166,9 +172,15 @@ export declare function makeModelMap<T>(input: T[], read: ReadModelKeyFunction<T
|
|
|
166
172
|
*
|
|
167
173
|
* If multiple models share the same relation key, the last one wins for that key.
|
|
168
174
|
*
|
|
175
|
+
* @dbxUtil
|
|
176
|
+
* @dbxUtilCategory model
|
|
177
|
+
* @dbxUtilTags model, map, key, multi, relation, index, lookup
|
|
178
|
+
* @dbxUtilRelated make-model-map, read-model-key
|
|
179
|
+
*
|
|
169
180
|
* @param input - Array of models to index
|
|
170
181
|
* @param read - Function that returns an array of relation keys for each model
|
|
171
182
|
* @returns Map from relation key to model
|
|
183
|
+
* @__NO_SIDE_EFFECTS__
|
|
172
184
|
*/
|
|
173
185
|
export declare function makeMultiModelKeyMap<T>(input: T[], read: ReadRelationKeysFunction<T>): MultiModelKeyMap<T>;
|
|
174
186
|
/**
|
|
@@ -281,9 +293,16 @@ export type ModelTypeDataPairFactory<T, M extends ModelTypeString = ModelTypeStr
|
|
|
281
293
|
*
|
|
282
294
|
* Falls back to the provided default type if the type reader returns a nullish value.
|
|
283
295
|
*
|
|
296
|
+
* @dbxUtil
|
|
297
|
+
* @dbxUtilCategory model
|
|
298
|
+
* @dbxUtilKind factory
|
|
299
|
+
* @dbxUtilTags model, type, pair, factory, wrap
|
|
300
|
+
* @dbxUtilRelated read-model-key, encode-model-key-type-pair
|
|
301
|
+
*
|
|
284
302
|
* @param typeReader - Function to extract the model type from input data
|
|
285
303
|
* @param defaultType - Fallback type string when the reader returns nullish
|
|
286
304
|
* @returns Factory function that produces ModelTypeDataPair values
|
|
305
|
+
* @__NO_SIDE_EFFECTS__
|
|
287
306
|
*/
|
|
288
307
|
export declare function modelTypeDataPairFactory<T, M extends ModelTypeString = ModelTypeString>(typeReader: ReadModelTypeFunction<T, M>, defaultType?: string): ModelTypeDataPairFactory<T, M>;
|
|
289
308
|
/**
|
|
@@ -47,8 +47,15 @@ export interface ModifyModelMapFunctionsConfig<V extends object, D extends objec
|
|
|
47
47
|
*
|
|
48
48
|
* Optionally copies the input object before modification to avoid mutating the original.
|
|
49
49
|
*
|
|
50
|
+
* @dbxUtil
|
|
51
|
+
* @dbxUtilCategory model
|
|
52
|
+
* @dbxUtilKind factory
|
|
53
|
+
* @dbxUtilTags model, map, modify, factory, modifier, copy
|
|
54
|
+
* @dbxUtilRelated make-model-map-functions, modify-model-map-function
|
|
55
|
+
*
|
|
50
56
|
* @param config - Configuration with the base map functions, modifiers, and copy options
|
|
51
57
|
* @returns New model map functions with modifiers applied before each conversion
|
|
58
|
+
* @__NO_SIDE_EFFECTS__
|
|
52
59
|
*/
|
|
53
60
|
export declare function modifyModelMapFunctions<V extends object, D extends object>(config: ModifyModelMapFunctionsConfig<V, D>): ModelMapFunctions<V, D>;
|
|
54
61
|
/**
|
|
@@ -57,9 +64,16 @@ export declare function modifyModelMapFunctions<V extends object, D extends obje
|
|
|
57
64
|
* When `copy` is true (default), the input is shallow-copied before modification to avoid mutating the original.
|
|
58
65
|
* If no modifier is provided, the original map function is returned unchanged.
|
|
59
66
|
*
|
|
67
|
+
* @dbxUtil
|
|
68
|
+
* @dbxUtilCategory model
|
|
69
|
+
* @dbxUtilKind factory
|
|
70
|
+
* @dbxUtilTags model, map, modify, factory, modifier, wrap
|
|
71
|
+
* @dbxUtilRelated modify-model-map-functions, model-field-map-function
|
|
72
|
+
*
|
|
60
73
|
* @param mapFn - The base map function to wrap
|
|
61
74
|
* @param modifyModel - Optional modifier to apply before mapping
|
|
62
75
|
* @param copy - Whether to shallow-copy the input before modifying; defaults to true
|
|
63
76
|
* @returns The wrapped map function, or the original if no modifier is provided
|
|
77
|
+
* @__NO_SIDE_EFFECTS__
|
|
64
78
|
*/
|
|
65
79
|
export declare function modifyModelMapFunction<I extends object, O extends object>(mapFn: ModelMapFunction<I, O>, modifyModel: Maybe<ModifierFunction<I>>, copy?: boolean): ModelMapFunction<I, O>;
|
|
@@ -5,8 +5,15 @@ export type ReadableStreamToStringFunction = (stream: NodeJS.ReadableStream) =>
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a function that reads a Node.js ReadableStream and converts its contents to a string using the specified encoding.
|
|
7
7
|
*
|
|
8
|
+
* @dbxUtil
|
|
9
|
+
* @dbxUtilCategory nodejs
|
|
10
|
+
* @dbxUtilKind factory
|
|
11
|
+
* @dbxUtilTags nodejs, stream, readable, string, factory, encoding
|
|
12
|
+
* @dbxUtilRelated readable-stream-to-buffer, readable-stream-to-base64
|
|
13
|
+
*
|
|
8
14
|
* @param encoding - The buffer encoding to use (e.g., 'utf-8', 'base64')
|
|
9
15
|
* @returns A function that consumes a ReadableStream and resolves to its string content
|
|
16
|
+
* @__NO_SIDE_EFFECTS__
|
|
10
17
|
*/
|
|
11
18
|
export declare function readableStreamToStringFunction(encoding: BufferEncoding): ReadableStreamToStringFunction;
|
|
12
19
|
/**
|
|
@@ -29,6 +29,7 @@ export type IsInNumberBoundFunction = (number: number) => boolean;
|
|
|
29
29
|
* @param bounds - The min/max bounds to test against
|
|
30
30
|
* @returns A function that returns `true` if the input number is within bounds
|
|
31
31
|
* @throws Error if the bounds are invalid (min > max)
|
|
32
|
+
* @__NO_SIDE_EFFECTS__
|
|
32
33
|
*/
|
|
33
34
|
export declare function isInNumberBoundFunction(bounds: NumberBound): IsInNumberBoundFunction;
|
|
34
35
|
export interface WrapNumberFunctionConfig<T extends number = number> extends NumberBound<T> {
|
|
@@ -55,6 +56,7 @@ export type WrapNumberFunction<T extends number = number> = MapFunction<number,
|
|
|
55
56
|
*
|
|
56
57
|
* @param wrapNumberFunctionConfig - Configuration with min, max, and optional fence post behavior
|
|
57
58
|
* @returns A function that wraps input numbers into the bounded range
|
|
59
|
+
* @__NO_SIDE_EFFECTS__
|
|
58
60
|
*/
|
|
59
61
|
export declare function wrapNumberFunction<T extends number = number>(wrapNumberFunctionConfig: WrapNumberFunctionConfig<T>): WrapNumberFunction<T>;
|
|
60
62
|
export interface BoundNumberFunctionConfig<T extends number = number> extends NumberBound<T> {
|
|
@@ -79,6 +81,7 @@ export type BoundNumberFunction<T extends number = number> = MapFunction<number,
|
|
|
79
81
|
*
|
|
80
82
|
* @param boundNumberFunctionConfig - Configuration with min, max, and optional wrap behavior
|
|
81
83
|
* @returns A function that bounds input numbers into the configured range
|
|
84
|
+
* @__NO_SIDE_EFFECTS__
|
|
82
85
|
*/
|
|
83
86
|
export declare function boundNumberFunction<T extends number = number>(boundNumberFunctionConfig: BoundNumberFunctionConfig<T>): BoundNumberFunction<T>;
|
|
84
87
|
/**
|
|
@@ -98,7 +98,14 @@ export type DollarAmountStringWithUnitFunction<U extends DollarAmountUnit> = ((a
|
|
|
98
98
|
/**
|
|
99
99
|
* Creates a function that formats dollar amounts as strings with a unit prefix (e.g., "$12.50").
|
|
100
100
|
*
|
|
101
|
+
* @dbxUtil
|
|
102
|
+
* @dbxUtilCategory number
|
|
103
|
+
* @dbxUtilKind factory
|
|
104
|
+
* @dbxUtilTags number, dollar, currency, format, factory, unit
|
|
105
|
+
* @dbxUtilRelated dollar-amount-string
|
|
106
|
+
*
|
|
101
107
|
* @param unit - The unit prefix to prepend; defaults to "$"
|
|
102
108
|
* @returns A function that formats dollar amounts with the configured unit
|
|
109
|
+
* @__NO_SIDE_EFFECTS__
|
|
103
110
|
*/
|
|
104
111
|
export declare function dollarAmountStringWithUnitFunction<U extends DollarAmountUnit>(unit?: U): DollarAmountStringWithUnitFunction<U>;
|
|
@@ -19,6 +19,12 @@ export interface IncrementingNumberFactoryConfig {
|
|
|
19
19
|
* @param config - Configuration with optional `startAt` (default 0) and `increaseBy` (default 1)
|
|
20
20
|
* @returns A factory function that returns the next number in the sequence on each call
|
|
21
21
|
*
|
|
22
|
+
* @dbxUtil
|
|
23
|
+
* @dbxUtilCategory number
|
|
24
|
+
* @dbxUtilKind factory
|
|
25
|
+
* @dbxUtilTags number, factory, increment, sequence, counter
|
|
26
|
+
* @dbxUtilRelated random-number-factory
|
|
27
|
+
*
|
|
22
28
|
* @example
|
|
23
29
|
* ```ts
|
|
24
30
|
* const factory = incrementingNumberFactory({ startAt: 10, increaseBy: 5 });
|
|
@@ -26,5 +32,6 @@ export interface IncrementingNumberFactoryConfig {
|
|
|
26
32
|
* factory(); // 15
|
|
27
33
|
* factory(); // 20
|
|
28
34
|
* ```
|
|
35
|
+
* @__NO_SIDE_EFFECTS__
|
|
29
36
|
*/
|
|
30
37
|
export declare function incrementingNumberFactory(config?: IncrementingNumberFactoryConfig): NumberFactory;
|
|
@@ -38,6 +38,7 @@ export type RandomNumberFactoryInput = number | RandomNumberFactoryConfig;
|
|
|
38
38
|
* @param maxOrArgs - Maximum value (exclusive) or full configuration object
|
|
39
39
|
* @param roundingInput - Optional rounding mode override
|
|
40
40
|
* @returns A factory function that produces random numbers within the range
|
|
41
|
+
* @__NO_SIDE_EFFECTS__
|
|
41
42
|
*/
|
|
42
43
|
export declare function randomNumberFactory(maxOrArgs: RandomNumberFactoryInput, roundingInput?: RoundingInput): RandomNumberFactory;
|
|
43
44
|
/**
|
|
@@ -15,6 +15,7 @@ export type RoundingFunction = MapFunction<number, number>;
|
|
|
15
15
|
*
|
|
16
16
|
* @param type - The rounding strategy: 'floor', 'ceil', 'round', or 'none'
|
|
17
17
|
* @returns The corresponding Math function, or an identity function for 'none'
|
|
18
|
+
* @__NO_SIDE_EFFECTS__
|
|
18
19
|
*/
|
|
19
20
|
export declare function roundingFunction(type: NumberRounding): RoundingFunction;
|
|
20
21
|
export type RoundingInput = NumberRounding | RoundingFunction;
|
|
@@ -66,9 +67,16 @@ export type CutValueToPrecisionFunction = ((input: AsNumberInput) => number) & {
|
|
|
66
67
|
/**
|
|
67
68
|
* Creates a {@link CutValueToPrecisionFunction} that truncates values to the configured precision.
|
|
68
69
|
*
|
|
70
|
+
* @dbxUtil
|
|
71
|
+
* @dbxUtilCategory number
|
|
72
|
+
* @dbxUtilKind factory
|
|
73
|
+
* @dbxUtilTags number, precision, cut, truncate, factory, round
|
|
74
|
+
* @dbxUtilRelated round-to-precision-function, cut-to-precision
|
|
75
|
+
*
|
|
69
76
|
* @param precision - Number of decimal places to retain
|
|
70
77
|
* @param roundingType - Rounding strategy; defaults to 'cut' (truncation)
|
|
71
78
|
* @returns A function that accepts a number or string and returns the truncated number
|
|
79
|
+
* @__NO_SIDE_EFFECTS__
|
|
72
80
|
*/
|
|
73
81
|
export declare function cutValueToPrecisionFunction(precision: NumberPrecision, roundingType?: RoundToPrecisionFunctionType): CutValueToPrecisionFunction;
|
|
74
82
|
/**
|
|
@@ -83,9 +91,16 @@ export type RoundToPrecisionFunctionType = NumberRounding | 'cut';
|
|
|
83
91
|
/**
|
|
84
92
|
* Creates a function that rounds numbers to the specified precision using a configurable rounding strategy.
|
|
85
93
|
*
|
|
94
|
+
* @dbxUtil
|
|
95
|
+
* @dbxUtilCategory number
|
|
96
|
+
* @dbxUtilKind factory
|
|
97
|
+
* @dbxUtilTags number, round, precision, factory, decimals
|
|
98
|
+
* @dbxUtilRelated cut-value-to-precision-function, round-to-precision, cut-to-precision
|
|
99
|
+
*
|
|
86
100
|
* @param precision - Number of decimal places
|
|
87
101
|
* @param roundFn - Rounding strategy; defaults to 'round'. Use 'cut' for truncation.
|
|
88
102
|
* @returns A function that rounds numbers to the configured precision
|
|
103
|
+
* @__NO_SIDE_EFFECTS__
|
|
89
104
|
*/
|
|
90
105
|
export declare function roundToPrecisionFunction(precision: NumberPrecision, roundFn?: RoundToPrecisionFunctionType): RoundToPrecisionFunction;
|
|
91
106
|
/**
|
|
@@ -160,8 +175,15 @@ export type RoundNumberToStepFunction = ((input: Maybe<number>) => number) & {
|
|
|
160
175
|
*
|
|
161
176
|
* Accepts either a step number (uses 'ceil' rounding) or a full config with step, rounding type, and origin.
|
|
162
177
|
*
|
|
178
|
+
* @dbxUtil
|
|
179
|
+
* @dbxUtilCategory number
|
|
180
|
+
* @dbxUtilKind factory
|
|
181
|
+
* @dbxUtilTags number, round, step, factory, multiple, origin
|
|
182
|
+
* @dbxUtilRelated round-number-up-to-step, round-to-precision-function
|
|
183
|
+
*
|
|
163
184
|
* @param input - Step size or full configuration
|
|
164
185
|
* @returns A function that rounds input numbers to the nearest step
|
|
165
186
|
* @throws Error if step is 0 or undefined
|
|
187
|
+
* @__NO_SIDE_EFFECTS__
|
|
166
188
|
*/
|
|
167
189
|
export declare function roundNumberToStepFunction(input: RoundNumberToStepFunctionInput): RoundNumberToStepFunction;
|
package/src/lib/number/sort.d.ts
CHANGED
|
@@ -7,8 +7,15 @@ export type SortByNumberFunction<T> = SortCompareFunction<T>;
|
|
|
7
7
|
/**
|
|
8
8
|
* Creates a {@link SortCompareFunction} that sorts values in ascending order by a numeric property.
|
|
9
9
|
*
|
|
10
|
+
* @dbxUtil
|
|
11
|
+
* @dbxUtilCategory number
|
|
12
|
+
* @dbxUtilKind factory
|
|
13
|
+
* @dbxUtilTags number, sort, compare, ascending, factory
|
|
14
|
+
* @dbxUtilRelated sort-numbers-ascending-function, sort-by-string-function
|
|
15
|
+
*
|
|
10
16
|
* @param readNumberFn - Function that extracts the numeric value from each item
|
|
11
17
|
* @returns A sort comparator function for ascending numeric order
|
|
18
|
+
* @__NO_SIDE_EFFECTS__
|
|
12
19
|
*/
|
|
13
20
|
export declare function sortByNumberFunction<T>(readNumberFn: ReadNumberFunction<T>): SortByNumberFunction<T>;
|
|
14
21
|
/**
|
|
@@ -39,7 +39,14 @@ export declare function transformNumberFunctionConfig<S extends number = number>
|
|
|
39
39
|
*
|
|
40
40
|
* Chains the configured operations in order: custom transform, step rounding, precision cut, then bounds clamping.
|
|
41
41
|
*
|
|
42
|
+
* @dbxUtil
|
|
43
|
+
* @dbxUtilCategory number
|
|
44
|
+
* @dbxUtilKind factory
|
|
45
|
+
* @dbxUtilTags number, transform, factory, round, precision, bounds, chain
|
|
46
|
+
* @dbxUtilRelated transform-string-function, round-number-to-step-function
|
|
47
|
+
*
|
|
42
48
|
* @param config - Configuration with optional transform, roundToStep, precision, and bounds
|
|
43
49
|
* @returns A single function that applies all configured transformations in sequence
|
|
50
|
+
* @__NO_SIDE_EFFECTS__
|
|
44
51
|
*/
|
|
45
52
|
export declare function transformNumberFunction<N extends number = number>(config: TransformNumberFunctionConfig<N>): TransformNumberFunction<N>;
|
|
@@ -45,7 +45,14 @@ export interface ObjectDeltaArrayCompressor<T extends object> {
|
|
|
45
45
|
* The first object is stored fully. Subsequent objects store only fields that changed from the previous entry.
|
|
46
46
|
* Null in a delta entry means the field was cleared. Undefined (missing key) means no change.
|
|
47
47
|
*
|
|
48
|
+
* @dbxUtil
|
|
49
|
+
* @dbxUtilCategory object
|
|
50
|
+
* @dbxUtilKind factory
|
|
51
|
+
* @dbxUtilTags object, delta, array, compress, expand, factory
|
|
52
|
+
* @dbxUtilRelated equality-comparator-function, object-keys-equality-comparator-function
|
|
53
|
+
*
|
|
48
54
|
* @param config - Configuration with the equality checker that defines which fields to track
|
|
49
55
|
* @returns A compressor with `compress` and `expand` methods
|
|
56
|
+
* @__NO_SIDE_EFFECTS__
|
|
50
57
|
*/
|
|
51
58
|
export declare function objectDeltaArrayCompressor<T extends object>(config: ObjectDeltaArrayCompressorConfig<T>): ObjectDeltaArrayCompressor<T>;
|
|
@@ -89,7 +89,14 @@ export type ObjectFieldEqualityChecker<T extends object> = ((a: Partial<T>, b: P
|
|
|
89
89
|
*
|
|
90
90
|
* Fields can be specified as simple field names (using the default `===` comparator) or as config objects with custom comparators.
|
|
91
91
|
*
|
|
92
|
+
* @dbxUtil
|
|
93
|
+
* @dbxUtilCategory object
|
|
94
|
+
* @dbxUtilKind factory
|
|
95
|
+
* @dbxUtilTags object, equality, fields, comparator, factory
|
|
96
|
+
* @dbxUtilRelated object-keys-equality-comparator-function, object-key-equality-comparator-function
|
|
97
|
+
*
|
|
92
98
|
* @param config - Configuration with the fields to compare and an optional default equality function
|
|
93
99
|
* @returns A function that compares two objects and reports which fields are equal/unequal
|
|
100
|
+
* @__NO_SIDE_EFFECTS__
|
|
94
101
|
*/
|
|
95
102
|
export declare function objectFieldEqualityChecker<T extends object>(config: ObjectFieldEqualityCheckerConfig<T>): ObjectFieldEqualityChecker<T>;
|
|
@@ -16,12 +16,19 @@ export type StripObjectFunction<T extends object> = (input: Maybe<T>, copy?: May
|
|
|
16
16
|
* @param copy - When true (default), the returned function shallow-copies the input before filtering instead of mutating it.
|
|
17
17
|
* @returns A function that returns the stripped object, or `undefined` when filtering removed every key.
|
|
18
18
|
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory object
|
|
21
|
+
* @dbxUtilKind factory
|
|
22
|
+
* @dbxUtilTags object, strip, filter, factory, undefined, empty
|
|
23
|
+
* @dbxUtilRelated strip-object, filter-from-pojo-function
|
|
24
|
+
*
|
|
19
25
|
* @example
|
|
20
26
|
* ```ts
|
|
21
27
|
* const stripUndef = stripObjectFunction(KeyValueTypleValueFilter.UNDEFINED);
|
|
22
28
|
* stripUndef({ a: 1, b: undefined }); // { a: 1 }
|
|
23
29
|
* stripUndef({ a: undefined }); // undefined
|
|
24
30
|
* ```
|
|
31
|
+
* @__NO_SIDE_EFFECTS__
|
|
25
32
|
*/
|
|
26
33
|
export declare function stripObjectFunction<T extends object>(filter: FilterKeyValueTuplesInput<T>, copy?: boolean): StripObjectFunction<T>;
|
|
27
34
|
/**
|
|
@@ -130,6 +137,14 @@ export interface OverrideInObjectFunctionFactoryConfig<T extends object> {
|
|
|
130
137
|
* const result = overrideFn({ color: 'blue', size: 5 });
|
|
131
138
|
* // result is { color: 'red', size: 10 } (a new copy)
|
|
132
139
|
* ```
|
|
140
|
+
*
|
|
141
|
+
* @dbxUtil
|
|
142
|
+
* @dbxUtilCategory object
|
|
143
|
+
* @dbxUtilKind factory
|
|
144
|
+
* @dbxUtilTags object, override, factory, merge, template, cached
|
|
145
|
+
* @dbxUtilRelated override-in-object, merge-objects-function, filter-from-pojo-function
|
|
146
|
+
*
|
|
147
|
+
* @__NO_SIDE_EFFECTS__
|
|
133
148
|
*/
|
|
134
149
|
export declare function overrideInObjectFunctionFactory<T extends object>({ filter, copy, dynamic }: OverrideInObjectFunctionFactoryConfig<T>): OverrideInObjectFunctionFactory<T>;
|
|
135
150
|
/**
|
|
@@ -179,6 +194,14 @@ export type MergeObjectsFunction<T extends object> = (objects: Maybe<Partial<T>>
|
|
|
179
194
|
* // With null filter to also exclude null values:
|
|
180
195
|
* const mergeNoNulls = mergeObjectsFunction(KeyValueTypleValueFilter.NULL);
|
|
181
196
|
* ```
|
|
197
|
+
*
|
|
198
|
+
* @dbxUtil
|
|
199
|
+
* @dbxUtilCategory object
|
|
200
|
+
* @dbxUtilKind factory
|
|
201
|
+
* @dbxUtilTags object, merge, factory, filter
|
|
202
|
+
* @dbxUtilRelated merge-objects, override-in-object-function-factory
|
|
203
|
+
*
|
|
204
|
+
* @__NO_SIDE_EFFECTS__
|
|
182
205
|
*/
|
|
183
206
|
export declare function mergeObjectsFunction<T extends object>(filter?: FilterKeyValueTuplesInput<T>): MergeObjectsFunction<T>;
|
|
184
207
|
/**
|
|
@@ -318,6 +341,14 @@ export type GeneralFindPOJOKeysFunction = <T extends object>(obj: T) => (keyof T
|
|
|
318
341
|
* findDefinedKeys({ a: 1, b: undefined, c: 'hello' });
|
|
319
342
|
* // ['a', 'c']
|
|
320
343
|
* ```
|
|
344
|
+
*
|
|
345
|
+
* @dbxUtil
|
|
346
|
+
* @dbxUtilCategory object
|
|
347
|
+
* @dbxUtilKind factory
|
|
348
|
+
* @dbxUtilTags object, pojo, keys, find, factory, filter
|
|
349
|
+
* @dbxUtilRelated find-pojo-keys, count-pojo-keys-function, for-each-key-value-on-pojo-function
|
|
350
|
+
*
|
|
351
|
+
* @__NO_SIDE_EFFECTS__
|
|
321
352
|
*/
|
|
322
353
|
export declare function findPOJOKeysFunction<T extends object>(filter: FilterKeyValueTuplesInput<T>): FindPOJOKeysFunction<T>;
|
|
323
354
|
/**
|
|
@@ -357,6 +388,14 @@ export type CountPOJOKeysFunction<T> = (obj: T) => number;
|
|
|
357
388
|
* countDefined({ a: 1, b: undefined, c: 'test' });
|
|
358
389
|
* // 2
|
|
359
390
|
* ```
|
|
391
|
+
*
|
|
392
|
+
* @dbxUtil
|
|
393
|
+
* @dbxUtilCategory object
|
|
394
|
+
* @dbxUtilKind factory
|
|
395
|
+
* @dbxUtilTags object, pojo, keys, count, factory, filter
|
|
396
|
+
* @dbxUtilRelated count-pojo-keys, find-pojo-keys-function
|
|
397
|
+
*
|
|
398
|
+
* @__NO_SIDE_EFFECTS__
|
|
360
399
|
*/
|
|
361
400
|
export declare function countPOJOKeysFunction<T extends object>(filter?: FilterKeyValueTuplesInput<T>): CountPOJOKeysFunction<T>;
|
|
362
401
|
/**
|
|
@@ -431,6 +470,14 @@ export type GeneralFilterFromPOJOFunction<X = object> = <T extends X>(input: T)
|
|
|
431
470
|
* const result = filterNulls({ a: 1, b: null, c: undefined });
|
|
432
471
|
* // result is { a: 1 }, original is unchanged
|
|
433
472
|
* ```
|
|
473
|
+
*
|
|
474
|
+
* @dbxUtil
|
|
475
|
+
* @dbxUtilCategory object
|
|
476
|
+
* @dbxUtilKind factory
|
|
477
|
+
* @dbxUtilTags object, pojo, filter, factory, remove, copy
|
|
478
|
+
* @dbxUtilRelated filter-from-pojo, strip-object-function, assign-values-to-pojo-function
|
|
479
|
+
*
|
|
480
|
+
* @__NO_SIDE_EFFECTS__
|
|
434
481
|
*/
|
|
435
482
|
export declare function filterFromPOJOFunction<T extends object>({ copy, filter: inputFilter }?: FilterFromPOJO<T>): FilterFromPOJOFunction<T>;
|
|
436
483
|
/**
|
|
@@ -516,6 +563,14 @@ export type AssignValuesToPOJOFunctionInput<T extends object = object, K extends
|
|
|
516
563
|
* // With NULL filter and no copy:
|
|
517
564
|
* const assignNoNulls = assignValuesToPOJOFunction({ valueFilter: KeyValueTypleValueFilter.NULL, copy: false });
|
|
518
565
|
* ```
|
|
566
|
+
*
|
|
567
|
+
* @dbxUtil
|
|
568
|
+
* @dbxUtilCategory object
|
|
569
|
+
* @dbxUtilKind factory
|
|
570
|
+
* @dbxUtilTags object, pojo, assign, factory, filter, copy
|
|
571
|
+
* @dbxUtilRelated assign-values-to-pojo, filter-from-pojo-function
|
|
572
|
+
*
|
|
573
|
+
* @__NO_SIDE_EFFECTS__
|
|
519
574
|
*/
|
|
520
575
|
export declare function assignValuesToPOJOFunction<T extends object, K extends keyof T = keyof T>(input?: AssignValuesToPOJOFunctionInput<T, K>): AssignValuesToPOJOFunction<T>;
|
|
521
576
|
/**
|
|
@@ -562,6 +617,14 @@ export type ValuesFromPOJOFunction<O = unknown, I extends object = object> = (ob
|
|
|
562
617
|
* getNonNullValues({ a: 1, b: null, c: undefined });
|
|
563
618
|
* // [1]
|
|
564
619
|
* ```
|
|
620
|
+
*
|
|
621
|
+
* @dbxUtil
|
|
622
|
+
* @dbxUtilCategory object
|
|
623
|
+
* @dbxUtilKind factory
|
|
624
|
+
* @dbxUtilTags object, pojo, values, factory, filter, extract
|
|
625
|
+
* @dbxUtilRelated values-from-pojo, find-pojo-keys-function
|
|
626
|
+
*
|
|
627
|
+
* @__NO_SIDE_EFFECTS__
|
|
565
628
|
*/
|
|
566
629
|
export declare function valuesFromPOJOFunction<O = unknown, I extends object = object>(filter?: FilterKeyValueTuplesInput<I>): ValuesFromPOJOFunction<O, I>;
|
|
567
630
|
/**
|
|
@@ -584,6 +647,14 @@ export declare function valuesFromPOJOFunction<O = unknown, I extends object = o
|
|
|
584
647
|
* omitAB({ a: 1, b: 2, c: 3 });
|
|
585
648
|
* // { c: 3 }
|
|
586
649
|
* ```
|
|
650
|
+
*
|
|
651
|
+
* @dbxUtil
|
|
652
|
+
* @dbxUtilCategory object
|
|
653
|
+
* @dbxUtilKind factory
|
|
654
|
+
* @dbxUtilTags object, pojo, keys, filter, pick, omit, factory
|
|
655
|
+
* @dbxUtilRelated filter-tuples-on-pojo-function, filter-from-pojo-function
|
|
656
|
+
*
|
|
657
|
+
* @__NO_SIDE_EFFECTS__
|
|
587
658
|
*/
|
|
588
659
|
export declare function filterKeysOnPOJOFunction<T extends object>(keysToFilter: Iterable<string>, invertFilter?: boolean): FilterTuplesOnPOJOFunction<T>;
|
|
589
660
|
/**
|
|
@@ -610,6 +681,14 @@ export type FilterTuplesOnPOJOFunction<T extends object> = T extends Record<stri
|
|
|
610
681
|
* keepStrings({ a: 'hello', b: 42, c: 'world' });
|
|
611
682
|
* // { a: 'hello', c: 'world' }
|
|
612
683
|
* ```
|
|
684
|
+
*
|
|
685
|
+
* @dbxUtil
|
|
686
|
+
* @dbxUtilCategory object
|
|
687
|
+
* @dbxUtilKind factory
|
|
688
|
+
* @dbxUtilTags object, pojo, tuples, filter, predicate, factory
|
|
689
|
+
* @dbxUtilRelated filter-keys-on-pojo-function, filter-from-pojo-function
|
|
690
|
+
*
|
|
691
|
+
* @__NO_SIDE_EFFECTS__
|
|
613
692
|
*/
|
|
614
693
|
export declare function filterTuplesOnPOJOFunction<T extends object>(filterTupleOnObject: FilterTuplesOnPOJOFilter<T>): FilterTuplesOnPOJOFunction<T>;
|
|
615
694
|
/**
|
|
@@ -671,5 +750,13 @@ export type ForEachKeyValueOnPOJOConfig<T extends object, C = unknown, K extends
|
|
|
671
750
|
* logDefined({ a: 1, b: undefined, c: 'test' });
|
|
672
751
|
* // logs: 'a' 1, 'c' 'test'
|
|
673
752
|
* ```
|
|
753
|
+
*
|
|
754
|
+
* @dbxUtil
|
|
755
|
+
* @dbxUtilCategory object
|
|
756
|
+
* @dbxUtilKind factory
|
|
757
|
+
* @dbxUtilTags object, pojo, for-each, iterate, factory, callback
|
|
758
|
+
* @dbxUtilRelated find-pojo-keys-function, count-pojo-keys-function, filter-key-value-tuples-function
|
|
759
|
+
*
|
|
760
|
+
* @__NO_SIDE_EFFECTS__
|
|
674
761
|
*/
|
|
675
762
|
export declare function forEachKeyValueOnPOJOFunction<T extends object, C = unknown, K extends keyof T = keyof T>({ forEach, filter }: ForEachKeyValueOnPOJOConfig<T, C, K>): ForEachKeyValueOnPOJOFunction<T, C>;
|