@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
|
@@ -30,8 +30,8 @@ export type TransformNumberFunctionConfigInput<S extends number = number> = Tran
|
|
|
30
30
|
*
|
|
31
31
|
* If a function is provided, wraps it as the `transform` field. Returns undefined for undefined input.
|
|
32
32
|
*
|
|
33
|
-
* @param config - A config object, a transform function, or undefined
|
|
34
|
-
* @returns The normalized config, or undefined
|
|
33
|
+
* @param config - A config object, a transform function, or undefined.
|
|
34
|
+
* @returns The normalized config, or undefined.
|
|
35
35
|
*/
|
|
36
36
|
export declare function transformNumberFunctionConfig<S extends number = number>(config?: TransformNumberFunctionConfigInput<S>): Maybe<TransformNumberFunctionConfig<S>>;
|
|
37
37
|
/**
|
|
@@ -39,14 +39,15 @@ 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
|
+
* @param config - Configuration with optional transform, roundToStep, precision, and bounds.
|
|
43
|
+
* @returns A single function that applies all configured transformations in sequence.
|
|
44
|
+
*
|
|
42
45
|
* @dbxUtil
|
|
43
46
|
* @dbxUtilCategory number
|
|
44
47
|
* @dbxUtilKind factory
|
|
45
48
|
* @dbxUtilTags number, transform, factory, round, precision, bounds, chain
|
|
46
49
|
* @dbxUtilRelated transform-string-function, round-number-to-step-function
|
|
47
50
|
*
|
|
48
|
-
* @param config - Configuration with optional transform, roundToStep, precision, and bounds
|
|
49
|
-
* @returns A single function that applies all configured transformations in sequence
|
|
50
51
|
* @__NO_SIDE_EFFECTS__
|
|
51
52
|
*/
|
|
52
53
|
export declare function transformNumberFunction<N extends number = number>(config: TransformNumberFunctionConfig<N>): TransformNumberFunction<N>;
|
|
@@ -5,9 +5,9 @@ import { type ArrayOrValue } from '../array';
|
|
|
5
5
|
*
|
|
6
6
|
* Convenience wrapper around {@link objectMergeMatrix} that flattens the result.
|
|
7
7
|
*
|
|
8
|
-
* @param a - First array (or single value) of partial objects
|
|
9
|
-
* @param b - Second array (or single value) of partial objects
|
|
10
|
-
* @returns Flat array of merged objects
|
|
8
|
+
* @param a - First array (or single value) of partial objects.
|
|
9
|
+
* @param b - Second array (or single value) of partial objects.
|
|
10
|
+
* @returns Flat array of merged objects.
|
|
11
11
|
*/
|
|
12
12
|
export declare function objectFlatMergeMatrix<A extends object = object, B extends object = object>(a: ArrayOrValue<Partial<A>>, b: ArrayOrValue<Partial<B>>): (Partial<A> & Partial<B>)[];
|
|
13
13
|
/**
|
|
@@ -16,8 +16,8 @@ export declare function objectFlatMergeMatrix<A extends object = object, B exten
|
|
|
16
16
|
* Each element in the matrix is the spread merge of one item from a with one item from b.
|
|
17
17
|
* If either input is null/undefined, returns the other as a single-row matrix.
|
|
18
18
|
*
|
|
19
|
-
* @param a - First array (or single value) of partial objects
|
|
20
|
-
* @param b - Second array (or single value) of partial objects
|
|
21
|
-
* @returns
|
|
19
|
+
* @param a - First array (or single value) of partial objects.
|
|
20
|
+
* @param b - Second array (or single value) of partial objects.
|
|
21
|
+
* @returns Two-dimensional array where `result[i][j]` is `{ ...a[i], ...b[j] }`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function objectMergeMatrix<A extends object = object, B extends object = object>(a: ArrayOrValue<Partial<A>>, b: ArrayOrValue<Partial<B>>): (Partial<A> & Partial<B>)[][];
|
|
@@ -45,14 +45,15 @@ 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
|
+
* @param config - Configuration with the equality checker that defines which fields to track.
|
|
49
|
+
* @returns A compressor with `compress` and `expand` methods.
|
|
50
|
+
*
|
|
48
51
|
* @dbxUtil
|
|
49
52
|
* @dbxUtilCategory object
|
|
50
53
|
* @dbxUtilKind factory
|
|
51
54
|
* @dbxUtilTags object, delta, array, compress, expand, factory
|
|
52
55
|
* @dbxUtilRelated equality-comparator-function, object-keys-equality-comparator-function
|
|
53
56
|
*
|
|
54
|
-
* @param config - Configuration with the equality checker that defines which fields to track
|
|
55
|
-
* @returns A compressor with `compress` and `expand` methods
|
|
56
57
|
* @__NO_SIDE_EFFECTS__
|
|
57
58
|
*/
|
|
58
59
|
export declare function objectDeltaArrayCompressor<T extends object>(config: ObjectDeltaArrayCompressorConfig<T>): ObjectDeltaArrayCompressor<T>;
|
|
@@ -24,13 +24,13 @@ export type EmptyObject = Record<string, never>;
|
|
|
24
24
|
/**
|
|
25
25
|
* Checks whether the object has no own enumerable keys.
|
|
26
26
|
*
|
|
27
|
+
* @param obj - Object to check.
|
|
28
|
+
* @returns `true` if the object has zero keys.
|
|
29
|
+
*
|
|
27
30
|
* @dbxUtil
|
|
28
31
|
* @dbxUtilCategory object
|
|
29
32
|
* @dbxUtilTags object, empty, keys, check, type-guard
|
|
30
33
|
* @dbxUtilRelated object-has-key, object-has-keys, has-value-or-not-empty-object
|
|
31
|
-
*
|
|
32
|
-
* @param obj - Object to check
|
|
33
|
-
* @returns `true` if the object has zero keys
|
|
34
34
|
*/
|
|
35
35
|
export declare function objectHasNoKeys(obj: object): obj is EmptyObject;
|
|
36
36
|
/**
|
|
@@ -67,9 +67,9 @@ export declare function objectHasKeys<T, K extends keyof T>(obj: T, keys: K[], m
|
|
|
67
67
|
/**
|
|
68
68
|
* Creates a partial object with the same value assigned to each of the specified fields.
|
|
69
69
|
*
|
|
70
|
-
* @param value - The value to assign to each field
|
|
71
|
-
* @param fields - Array of field names to set
|
|
72
|
-
* @returns A partial object with the value set on each specified field
|
|
70
|
+
* @param value - The value to assign to each field.
|
|
71
|
+
* @param fields - Array of field names to set.
|
|
72
|
+
* @returns A partial object with the value set on each specified field.
|
|
73
73
|
*/
|
|
74
74
|
export declare function applyToMultipleFields<T extends object, X = unknown>(value: X, fields: FieldOfType<T>[]): Partial<{
|
|
75
75
|
[K in keyof T]: X;
|
|
@@ -77,12 +77,12 @@ export declare function applyToMultipleFields<T extends object, X = unknown>(val
|
|
|
77
77
|
/**
|
|
78
78
|
* Converts a Map to a plain object by iterating entries and assigning key-value pairs.
|
|
79
79
|
*
|
|
80
|
+
* @param map - Map to convert.
|
|
81
|
+
* @returns A plain object with the same key-value pairs.
|
|
82
|
+
*
|
|
80
83
|
* @dbxUtil
|
|
81
84
|
* @dbxUtilCategory object
|
|
82
85
|
* @dbxUtilTags object, map, convert, transform, dictionary
|
|
83
|
-
*
|
|
84
|
-
* @param map - Map to convert
|
|
85
|
-
* @returns A plain object with the same key-value pairs
|
|
86
86
|
*/
|
|
87
87
|
export declare function mapToObject<T, K extends PropertyKey>(map: Map<K, T>): {
|
|
88
88
|
[key: PropertyKey]: T;
|
|
@@ -94,12 +94,12 @@ export type CopyObjectFunction<T> = (input: T) => T;
|
|
|
94
94
|
/**
|
|
95
95
|
* Creates a shallow copy of an object using the spread operator.
|
|
96
96
|
*
|
|
97
|
+
* @param input - Object to copy.
|
|
98
|
+
* @returns A new object with the same properties.
|
|
99
|
+
*
|
|
97
100
|
* @dbxUtil
|
|
98
101
|
* @dbxUtilCategory object
|
|
99
102
|
* @dbxUtilTags object, copy, clone, shallow, spread
|
|
100
103
|
* @dbxUtilRelated copy-array
|
|
101
|
-
*
|
|
102
|
-
* @param input - Object to copy
|
|
103
|
-
* @returns A new object with the same properties
|
|
104
104
|
*/
|
|
105
105
|
export declare function copyObject<T extends object>(input: T): T;
|
|
@@ -3,12 +3,12 @@ import { type Maybe } from '../value/maybe.type';
|
|
|
3
3
|
* Recursively checks whether an object is "empty" — meaning it is null/undefined, has no keys,
|
|
4
4
|
* or all of its values are themselves empty (recursively for nested objects, or falsy for primitives).
|
|
5
5
|
*
|
|
6
|
+
* @param obj - Object to check.
|
|
7
|
+
* @returns `true` if the object is considered empty.
|
|
8
|
+
*
|
|
6
9
|
* @dbxUtil
|
|
7
10
|
* @dbxUtilCategory object
|
|
8
11
|
* @dbxUtilTags object, empty, recursive, deep, check, has-value
|
|
9
12
|
* @dbxUtilRelated object-has-no-keys, has-value-or-not-empty-object
|
|
10
|
-
*
|
|
11
|
-
* @param obj - Object to check
|
|
12
|
-
* @returns `true` if the object is considered empty
|
|
13
13
|
*/
|
|
14
14
|
export declare function objectIsEmpty<T extends object>(obj: Maybe<T>): boolean;
|
|
@@ -6,14 +6,14 @@ import { type FilterFromPOJOFunction } from './object.filter.pojo';
|
|
|
6
6
|
*
|
|
7
7
|
* Recursively compares arrays, objects, Maps, Sets, primitives, and Dates.
|
|
8
8
|
*
|
|
9
|
+
* @param a - First value to compare.
|
|
10
|
+
* @param b - Second value to compare.
|
|
11
|
+
* @returns `true` if the values are deeply equal.
|
|
12
|
+
*
|
|
9
13
|
* @dbxUtil
|
|
10
14
|
* @dbxUtilCategory object
|
|
11
15
|
* @dbxUtilTags object, equal, equality, deep, compare, recursive, pojo
|
|
12
16
|
* @dbxUtilRelated are-equal-pojo-values-using-pojo-filter, all-objects-are-equal
|
|
13
|
-
*
|
|
14
|
-
* @param a - First value to compare
|
|
15
|
-
* @param b - Second value to compare
|
|
16
|
-
* @returns `true` if the values are deeply equal
|
|
17
17
|
*/
|
|
18
18
|
export declare function areEqualPOJOValues<F>(a: F, b: F): boolean;
|
|
19
19
|
/**
|
|
@@ -21,10 +21,10 @@ export declare function areEqualPOJOValues<F>(a: F, b: F): boolean;
|
|
|
21
21
|
*
|
|
22
22
|
* Recursively compares arrays, objects, Maps, Sets, primitives, and Dates.
|
|
23
23
|
*
|
|
24
|
-
* @param a - First value to compare
|
|
25
|
-
* @param b - Second value to compare
|
|
26
|
-
* @param pojoFilter - Filter function applied to each value before comparison
|
|
27
|
-
* @returns `true` if the filtered values are deeply equal
|
|
24
|
+
* @param a - First value to compare.
|
|
25
|
+
* @param b - Second value to compare.
|
|
26
|
+
* @param pojoFilter - Filter function applied to each value before comparison.
|
|
27
|
+
* @returns `true` if the filtered values are deeply equal.
|
|
28
28
|
*/
|
|
29
29
|
export declare function areEqualPOJOValuesUsingPojoFilter<F>(a: F, b: F, pojoFilter: FilterFromPOJOFunction<F>): boolean;
|
|
30
30
|
/**
|
|
@@ -89,14 +89,15 @@ 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
|
+
* @param config - Configuration with the fields to compare and an optional default equality function.
|
|
93
|
+
* @returns Compares two objects and reports which fields are equal/unequal.
|
|
94
|
+
*
|
|
92
95
|
* @dbxUtil
|
|
93
96
|
* @dbxUtilCategory object
|
|
94
97
|
* @dbxUtilKind factory
|
|
95
98
|
* @dbxUtilTags object, equality, fields, comparator, factory
|
|
96
99
|
* @dbxUtilRelated object-keys-equality-comparator-function, object-key-equality-comparator-function
|
|
97
100
|
*
|
|
98
|
-
* @param config - Configuration with the fields to compare and an optional default equality function
|
|
99
|
-
* @returns A function that compares two objects and reports which fields are equal/unequal
|
|
100
101
|
* @__NO_SIDE_EFFECTS__
|
|
101
102
|
*/
|
|
102
103
|
export declare function objectFieldEqualityChecker<T extends object>(config: ObjectFieldEqualityCheckerConfig<T>): ObjectFieldEqualityChecker<T>;
|
|
@@ -14,7 +14,7 @@ export type StripObjectFunction<T extends object> = (input: Maybe<T>, copy?: May
|
|
|
14
14
|
*
|
|
15
15
|
* @param filter - Filter controlling which key/value pairs are removed from the input object.
|
|
16
16
|
* @param copy - When true (default), the returned function shallow-copies the input before filtering instead of mutating it.
|
|
17
|
-
* @returns
|
|
17
|
+
* @returns Returns the stripped object, or `undefined` when filtering removed every key.
|
|
18
18
|
*
|
|
19
19
|
* @dbxUtil
|
|
20
20
|
* @dbxUtilCategory object
|
|
@@ -96,7 +96,7 @@ export interface OverrideInObjectFunctionFactoryConfig<T extends object> {
|
|
|
96
96
|
* Accepts a {@link KeyValueTypleValueFilter} enum value or a {@link KeyValueTupleFilter} object.
|
|
97
97
|
* When not provided, the default filter removes `undefined` values (i.e., `KeyValueTypleValueFilter.UNDEFINED`).
|
|
98
98
|
*/
|
|
99
|
-
filter?: FilterKeyValueTuplesInput<T>;
|
|
99
|
+
readonly filter?: FilterKeyValueTuplesInput<T>;
|
|
100
100
|
/**
|
|
101
101
|
* Whether or not to return a copy of the input value, rather than change it directly.
|
|
102
102
|
* If true, a copy of the input object will be returned.
|
|
@@ -104,7 +104,7 @@ export interface OverrideInObjectFunctionFactoryConfig<T extends object> {
|
|
|
104
104
|
*
|
|
105
105
|
* False by default.
|
|
106
106
|
*/
|
|
107
|
-
copy?: boolean;
|
|
107
|
+
readonly copy?: boolean;
|
|
108
108
|
/**
|
|
109
109
|
* Whether or not the template being applied to objects should be recalculated each time.
|
|
110
110
|
*
|
|
@@ -112,7 +112,7 @@ export interface OverrideInObjectFunctionFactoryConfig<T extends object> {
|
|
|
112
112
|
*
|
|
113
113
|
* False by default.
|
|
114
114
|
*/
|
|
115
|
-
dynamic?: boolean;
|
|
115
|
+
readonly dynamic?: boolean;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Creates an {@link OverrideInObjectFunctionFactory} that merges source objects into a template,
|
|
@@ -125,11 +125,17 @@ export interface OverrideInObjectFunctionFactoryConfig<T extends object> {
|
|
|
125
125
|
* By default, `undefined` values in sources are excluded from the template.
|
|
126
126
|
*
|
|
127
127
|
* @param config - Configuration controlling filtering, copying, and caching behavior.
|
|
128
|
-
* @param config.filter -
|
|
129
|
-
* @param config.copy -
|
|
130
|
-
* @param config.dynamic -
|
|
128
|
+
* @param config.filter - Filter applied to source object values when building the template; by default, `undefined` values are excluded.
|
|
129
|
+
* @param config.copy - When true, the target object is shallow-copied before applying overrides instead of being mutated in place.
|
|
130
|
+
* @param config.dynamic - When true, the template is recalculated on each call instead of being cached; useful when source objects may change over time.
|
|
131
131
|
* @returns A factory function that accepts source objects and returns an override function.
|
|
132
132
|
*
|
|
133
|
+
* @dbxUtil
|
|
134
|
+
* @dbxUtilCategory object
|
|
135
|
+
* @dbxUtilKind factory
|
|
136
|
+
* @dbxUtilTags object, override, factory, merge, template, cached
|
|
137
|
+
* @dbxUtilRelated override-in-object, merge-objects-function, filter-from-pojo-function
|
|
138
|
+
*
|
|
133
139
|
* @example
|
|
134
140
|
* ```typescript
|
|
135
141
|
* const factory = overrideInObjectFunctionFactory({ copy: true });
|
|
@@ -138,12 +144,6 @@ export interface OverrideInObjectFunctionFactoryConfig<T extends object> {
|
|
|
138
144
|
* // result is { color: 'red', size: 10 } (a new copy)
|
|
139
145
|
* ```
|
|
140
146
|
*
|
|
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
147
|
* @__NO_SIDE_EFFECTS__
|
|
148
148
|
*/
|
|
149
149
|
export declare function overrideInObjectFunctionFactory<T extends object>({ filter, copy, dynamic }: OverrideInObjectFunctionFactoryConfig<T>): OverrideInObjectFunctionFactory<T>;
|
|
@@ -185,6 +185,12 @@ export type MergeObjectsFunction<T extends object> = (objects: Maybe<Partial<T>>
|
|
|
185
185
|
* @param filter - Optional filter controlling which key/value pairs are included. Defaults to filtering out `undefined` values.
|
|
186
186
|
* @returns A reusable merge function.
|
|
187
187
|
*
|
|
188
|
+
* @dbxUtil
|
|
189
|
+
* @dbxUtilCategory object
|
|
190
|
+
* @dbxUtilKind factory
|
|
191
|
+
* @dbxUtilTags object, merge, factory, filter
|
|
192
|
+
* @dbxUtilRelated merge-objects, override-in-object-function-factory
|
|
193
|
+
*
|
|
188
194
|
* @example
|
|
189
195
|
* ```typescript
|
|
190
196
|
* const merge = mergeObjectsFunction();
|
|
@@ -195,12 +201,6 @@ export type MergeObjectsFunction<T extends object> = (objects: Maybe<Partial<T>>
|
|
|
195
201
|
* const mergeNoNulls = mergeObjectsFunction(KeyValueTypleValueFilter.NULL);
|
|
196
202
|
* ```
|
|
197
203
|
*
|
|
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
204
|
* @__NO_SIDE_EFFECTS__
|
|
205
205
|
*/
|
|
206
206
|
export declare function mergeObjectsFunction<T extends object>(filter?: FilterKeyValueTuplesInput<T>): MergeObjectsFunction<T>;
|
|
@@ -335,6 +335,12 @@ export type GeneralFindPOJOKeysFunction = <T extends object>(obj: T) => (keyof T
|
|
|
335
335
|
* @param filter - A {@link FilterKeyValueTuplesInput} controlling which values match. Required (no default).
|
|
336
336
|
* @returns A reusable function that returns matching keys from any input object.
|
|
337
337
|
*
|
|
338
|
+
* @dbxUtil
|
|
339
|
+
* @dbxUtilCategory object
|
|
340
|
+
* @dbxUtilKind factory
|
|
341
|
+
* @dbxUtilTags object, pojo, keys, find, factory, filter
|
|
342
|
+
* @dbxUtilRelated find-pojo-keys, count-pojo-keys-function, for-each-key-value-on-pojo-function
|
|
343
|
+
*
|
|
338
344
|
* @example
|
|
339
345
|
* ```typescript
|
|
340
346
|
* const findDefinedKeys = findPOJOKeysFunction(KeyValueTypleValueFilter.UNDEFINED);
|
|
@@ -342,12 +348,6 @@ export type GeneralFindPOJOKeysFunction = <T extends object>(obj: T) => (keyof T
|
|
|
342
348
|
* // ['a', 'c']
|
|
343
349
|
* ```
|
|
344
350
|
*
|
|
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
351
|
* @__NO_SIDE_EFFECTS__
|
|
352
352
|
*/
|
|
353
353
|
export declare function findPOJOKeysFunction<T extends object>(filter: FilterKeyValueTuplesInput<T>): FindPOJOKeysFunction<T>;
|
|
@@ -382,6 +382,12 @@ export type CountPOJOKeysFunction<T> = (obj: T) => number;
|
|
|
382
382
|
* @param filter - A {@link FilterKeyValueTuplesInput} controlling which values are counted. Defaults to `KeyValueTypleValueFilter.UNDEFINED`.
|
|
383
383
|
* @returns A reusable function that counts matching keys on any input object.
|
|
384
384
|
*
|
|
385
|
+
* @dbxUtil
|
|
386
|
+
* @dbxUtilCategory object
|
|
387
|
+
* @dbxUtilKind factory
|
|
388
|
+
* @dbxUtilTags object, pojo, keys, count, factory, filter
|
|
389
|
+
* @dbxUtilRelated count-pojo-keys, find-pojo-keys-function
|
|
390
|
+
*
|
|
385
391
|
* @example
|
|
386
392
|
* ```typescript
|
|
387
393
|
* const countDefined = countPOJOKeysFunction();
|
|
@@ -389,12 +395,6 @@ export type CountPOJOKeysFunction<T> = (obj: T) => number;
|
|
|
389
395
|
* // 2
|
|
390
396
|
* ```
|
|
391
397
|
*
|
|
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
398
|
* @__NO_SIDE_EFFECTS__
|
|
399
399
|
*/
|
|
400
400
|
export declare function countPOJOKeysFunction<T extends object>(filter?: FilterKeyValueTuplesInput<T>): CountPOJOKeysFunction<T>;
|
|
@@ -454,10 +454,16 @@ export type GeneralFilterFromPOJOFunction<X = object> = <T extends X>(input: T)
|
|
|
454
454
|
* By default, removes `undefined` values (`KeyValueTypleValueFilter.UNDEFINED`) and does not copy (`copy: false`).
|
|
455
455
|
*
|
|
456
456
|
* @param config - Configuration for filtering and copying. Defaults to `{ copy: false, filter: { valueFilter: KeyValueTypleValueFilter.UNDEFINED } }`.
|
|
457
|
-
* @param config.copy -
|
|
458
|
-
* @param config.filter -
|
|
457
|
+
* @param config.copy - When true, returns a shallow copy with filtered keys removed instead of mutating the input; defaults to false.
|
|
458
|
+
* @param config.filter - The filter criteria determining which key/value pairs to remove; defaults to removing `undefined` values.
|
|
459
459
|
* @returns A reusable filter function. The returned function also accepts a `copyOverride` argument to override the copy behavior per-call.
|
|
460
460
|
*
|
|
461
|
+
* @dbxUtil
|
|
462
|
+
* @dbxUtilCategory object
|
|
463
|
+
* @dbxUtilKind factory
|
|
464
|
+
* @dbxUtilTags object, pojo, filter, factory, remove, copy
|
|
465
|
+
* @dbxUtilRelated filter-from-pojo, strip-object-function, assign-values-to-pojo-function
|
|
466
|
+
*
|
|
461
467
|
* @example
|
|
462
468
|
* ```typescript
|
|
463
469
|
* // Default: removes undefined values, mutates in place
|
|
@@ -471,12 +477,6 @@ export type GeneralFilterFromPOJOFunction<X = object> = <T extends X>(input: T)
|
|
|
471
477
|
* // result is { a: 1 }, original is unchanged
|
|
472
478
|
* ```
|
|
473
479
|
*
|
|
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
480
|
* @__NO_SIDE_EFFECTS__
|
|
481
481
|
*/
|
|
482
482
|
export declare function filterFromPOJOFunction<T extends object>({ copy, filter: inputFilter }?: FilterFromPOJO<T>): FilterFromPOJOFunction<T>;
|
|
@@ -552,6 +552,12 @@ export type AssignValuesToPOJOFunctionInput<T extends object = object, K extends
|
|
|
552
552
|
* @param input - Filter and copy configuration. Defaults to `KeyValueTypleValueFilter.UNDEFINED` (filter undefined, copy target).
|
|
553
553
|
* @returns A reusable assign function with a `_returnCopyByDefault` property indicating the configured copy behavior.
|
|
554
554
|
*
|
|
555
|
+
* @dbxUtil
|
|
556
|
+
* @dbxUtilCategory object
|
|
557
|
+
* @dbxUtilKind factory
|
|
558
|
+
* @dbxUtilTags object, pojo, assign, factory, filter, copy
|
|
559
|
+
* @dbxUtilRelated assign-values-to-pojo, filter-from-pojo-function
|
|
560
|
+
*
|
|
555
561
|
* @example
|
|
556
562
|
* ```typescript
|
|
557
563
|
* // Default: filters undefined, returns a copy
|
|
@@ -564,12 +570,6 @@ export type AssignValuesToPOJOFunctionInput<T extends object = object, K extends
|
|
|
564
570
|
* const assignNoNulls = assignValuesToPOJOFunction({ valueFilter: KeyValueTypleValueFilter.NULL, copy: false });
|
|
565
571
|
* ```
|
|
566
572
|
*
|
|
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
573
|
* @__NO_SIDE_EFFECTS__
|
|
574
574
|
*/
|
|
575
575
|
export declare function assignValuesToPOJOFunction<T extends object, K extends keyof T = keyof T>(input?: AssignValuesToPOJOFunctionInput<T, K>): AssignValuesToPOJOFunction<T>;
|
|
@@ -607,6 +607,12 @@ export type ValuesFromPOJOFunction<O = unknown, I extends object = object> = (ob
|
|
|
607
607
|
* @param filter - A {@link FilterKeyValueTuplesInput} controlling which values are included. Defaults to `KeyValueTypleValueFilter.UNDEFINED`.
|
|
608
608
|
* @returns A reusable function that extracts matching values from any input object.
|
|
609
609
|
*
|
|
610
|
+
* @dbxUtil
|
|
611
|
+
* @dbxUtilCategory object
|
|
612
|
+
* @dbxUtilKind factory
|
|
613
|
+
* @dbxUtilTags object, pojo, values, factory, filter, extract
|
|
614
|
+
* @dbxUtilRelated values-from-pojo, find-pojo-keys-function
|
|
615
|
+
*
|
|
610
616
|
* @example
|
|
611
617
|
* ```typescript
|
|
612
618
|
* const getDefinedValues = valuesFromPOJOFunction();
|
|
@@ -618,12 +624,6 @@ export type ValuesFromPOJOFunction<O = unknown, I extends object = object> = (ob
|
|
|
618
624
|
* // [1]
|
|
619
625
|
* ```
|
|
620
626
|
*
|
|
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
627
|
* @__NO_SIDE_EFFECTS__
|
|
628
628
|
*/
|
|
629
629
|
export declare function valuesFromPOJOFunction<O = unknown, I extends object = object>(filter?: FilterKeyValueTuplesInput<I>): ValuesFromPOJOFunction<O, I>;
|
|
@@ -635,7 +635,13 @@ export declare function valuesFromPOJOFunction<O = unknown, I extends object = o
|
|
|
635
635
|
*
|
|
636
636
|
* @param keysToFilter - The set of keys to include (or exclude when inverted).
|
|
637
637
|
* @param invertFilter - When `true`, keys in `keysToFilter` are excluded instead of included. Defaults to `false`.
|
|
638
|
-
* @returns
|
|
638
|
+
* @returns Filters keys on any input POJO.
|
|
639
|
+
*
|
|
640
|
+
* @dbxUtil
|
|
641
|
+
* @dbxUtilCategory object
|
|
642
|
+
* @dbxUtilKind factory
|
|
643
|
+
* @dbxUtilTags object, pojo, keys, filter, pick, omit, factory
|
|
644
|
+
* @dbxUtilRelated filter-tuples-on-pojo-function, filter-from-pojo-function
|
|
639
645
|
*
|
|
640
646
|
* @example
|
|
641
647
|
* ```typescript
|
|
@@ -648,12 +654,6 @@ export declare function valuesFromPOJOFunction<O = unknown, I extends object = o
|
|
|
648
654
|
* // { c: 3 }
|
|
649
655
|
* ```
|
|
650
656
|
*
|
|
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
657
|
* @__NO_SIDE_EFFECTS__
|
|
658
658
|
*/
|
|
659
659
|
export declare function filterKeysOnPOJOFunction<T extends object>(keysToFilter: Iterable<string>, invertFilter?: boolean): FilterTuplesOnPOJOFunction<T>;
|
|
@@ -673,7 +673,13 @@ export type FilterTuplesOnPOJOFunction<T extends object> = T extends Record<stri
|
|
|
673
673
|
* and returns a new object containing only the entries that pass.
|
|
674
674
|
*
|
|
675
675
|
* @param filterTupleOnObject - Predicate applied to each `[key, value]` entry.
|
|
676
|
-
* @returns
|
|
676
|
+
* @returns Filters entries on any input POJO.
|
|
677
|
+
*
|
|
678
|
+
* @dbxUtil
|
|
679
|
+
* @dbxUtilCategory object
|
|
680
|
+
* @dbxUtilKind factory
|
|
681
|
+
* @dbxUtilTags object, pojo, tuples, filter, predicate, factory
|
|
682
|
+
* @dbxUtilRelated filter-keys-on-pojo-function, filter-from-pojo-function
|
|
677
683
|
*
|
|
678
684
|
* @example
|
|
679
685
|
* ```typescript
|
|
@@ -682,12 +688,6 @@ export type FilterTuplesOnPOJOFunction<T extends object> = T extends Record<stri
|
|
|
682
688
|
* // { a: 'hello', c: 'world' }
|
|
683
689
|
* ```
|
|
684
690
|
*
|
|
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
691
|
* @__NO_SIDE_EFFECTS__
|
|
692
692
|
*/
|
|
693
693
|
export declare function filterTuplesOnPOJOFunction<T extends object>(filterTupleOnObject: FilterTuplesOnPOJOFilter<T>): FilterTuplesOnPOJOFunction<T>;
|
|
@@ -737,9 +737,15 @@ export type ForEachKeyValueOnPOJOConfig<T extends object, C = unknown, K extends
|
|
|
737
737
|
* When no filter is provided, all key/value pairs are iterated.
|
|
738
738
|
*
|
|
739
739
|
* @param config - The filter and forEach callback configuration.
|
|
740
|
-
* @param config.forEach -
|
|
741
|
-
* @param config.filter -
|
|
742
|
-
* @returns
|
|
740
|
+
* @param config.forEach - Callback invoked for each key/value pair that passes the filter.
|
|
741
|
+
* @param config.filter - Optional filter controlling which key/value pairs are iterated; when omitted, all pairs are visited.
|
|
742
|
+
* @returns Iterates matching key/value pairs on any input object.
|
|
743
|
+
*
|
|
744
|
+
* @dbxUtil
|
|
745
|
+
* @dbxUtilCategory object
|
|
746
|
+
* @dbxUtilKind factory
|
|
747
|
+
* @dbxUtilTags object, pojo, for-each, iterate, factory, callback
|
|
748
|
+
* @dbxUtilRelated find-pojo-keys-function, count-pojo-keys-function, filter-key-value-tuples-function
|
|
743
749
|
*
|
|
744
750
|
* @example
|
|
745
751
|
* ```typescript
|
|
@@ -751,12 +757,6 @@ export type ForEachKeyValueOnPOJOConfig<T extends object, C = unknown, K extends
|
|
|
751
757
|
* // logs: 'a' 1, 'c' 'test'
|
|
752
758
|
* ```
|
|
753
759
|
*
|
|
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
760
|
* @__NO_SIDE_EFFECTS__
|
|
761
761
|
*/
|
|
762
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>;
|
|
@@ -14,10 +14,10 @@ export interface ForEachKeyValue<T extends object = object, K extends keyof T =
|
|
|
14
14
|
/**
|
|
15
15
|
* Iterates over filtered key/value tuples of an object and invokes a callback for each.
|
|
16
16
|
*
|
|
17
|
-
* @param obj - Object to iterate
|
|
18
|
-
* @param config - Configuration with a forEach callback and optional filter
|
|
19
|
-
* @param config.forEach -
|
|
20
|
-
* @param config.filter -
|
|
17
|
+
* @param obj - Object to iterate.
|
|
18
|
+
* @param config - Configuration with a forEach callback and optional filter.
|
|
19
|
+
* @param config.forEach - Callback invoked for each key/value tuple that passes the filter.
|
|
20
|
+
* @param config.filter - Optional filter controlling which key/value tuples are iterated; when omitted, all tuples are visited.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
@@ -33,9 +33,9 @@ export declare function forEachKeyValue<T extends object = object, K extends key
|
|
|
33
33
|
/**
|
|
34
34
|
* Extracts key/value tuples from an object, optionally filtering them.
|
|
35
35
|
*
|
|
36
|
-
* @param obj - Object to extract tuples from
|
|
37
|
-
* @param filter - Optional filter to apply to the tuples
|
|
38
|
-
* @returns Array of matching key/value tuples
|
|
36
|
+
* @param obj - Object to extract tuples from.
|
|
37
|
+
* @param filter - Optional filter to apply to the tuples.
|
|
38
|
+
* @returns Array of matching key/value tuples.
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```ts
|
|
@@ -57,8 +57,14 @@ export type FilterKeyValueTuplesFunction<T extends object = object, K extends ke
|
|
|
57
57
|
*
|
|
58
58
|
* When no filter is provided, returns all key/value tuples.
|
|
59
59
|
*
|
|
60
|
-
* @param filter - Optional filter configuration
|
|
61
|
-
* @returns
|
|
60
|
+
* @param filter - Optional filter configuration.
|
|
61
|
+
* @returns Extracts filtered tuples from any input object.
|
|
62
|
+
*
|
|
63
|
+
* @dbxUtil
|
|
64
|
+
* @dbxUtilCategory object
|
|
65
|
+
* @dbxUtilKind factory
|
|
66
|
+
* @dbxUtilTags object, tuples, filter, factory, key-value
|
|
67
|
+
* @dbxUtilRelated filter-key-value-tuple-function, for-each-key-value
|
|
62
68
|
*
|
|
63
69
|
* @example
|
|
64
70
|
* ```ts
|
|
@@ -67,20 +73,14 @@ export type FilterKeyValueTuplesFunction<T extends object = object, K extends ke
|
|
|
67
73
|
* // tuples: [['a', 1], ['c', 'hello']]
|
|
68
74
|
* ```
|
|
69
75
|
*
|
|
70
|
-
* @dbxUtil
|
|
71
|
-
* @dbxUtilCategory object
|
|
72
|
-
* @dbxUtilKind factory
|
|
73
|
-
* @dbxUtilTags object, tuples, filter, factory, key-value
|
|
74
|
-
* @dbxUtilRelated filter-key-value-tuple-function, for-each-key-value
|
|
75
|
-
*
|
|
76
76
|
* @__NO_SIDE_EFFECTS__
|
|
77
77
|
*/
|
|
78
78
|
export declare function filterKeyValueTuplesFunction<T extends object = object, K extends keyof T = keyof T>(filter?: FilterKeyValueTuplesInput<T, K>): FilterKeyValueTuplesFunction<T, K>;
|
|
79
79
|
/**
|
|
80
80
|
* Returns all key/value pairs from the object as tuples using `Object.entries`.
|
|
81
81
|
*
|
|
82
|
-
* @param obj - Object to extract tuples from
|
|
83
|
-
* @returns Array of `[key, value]` tuples
|
|
82
|
+
* @param obj - Object to extract tuples from.
|
|
83
|
+
* @returns Array of `[key, value]` tuples.
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
86
|
* ```ts
|
|
@@ -153,8 +153,8 @@ export interface KeyValueTupleFilter<T extends object = object, K extends keyof
|
|
|
153
153
|
*
|
|
154
154
|
* If the input is already an object, returns it as-is. If it's an enum value, wraps it in a filter object.
|
|
155
155
|
*
|
|
156
|
-
* @param input - Enum value or filter object
|
|
157
|
-
* @returns Normalized filter object
|
|
156
|
+
* @param input - Enum value or filter object.
|
|
157
|
+
* @returns Normalized filter object.
|
|
158
158
|
*/
|
|
159
159
|
export declare function filterKeyValueTuplesInputToFilter<T extends object = object, K extends keyof T = keyof T>(input: FilterKeyValueTuplesInput<T, K>): KeyValueTupleFilter<T, K>;
|
|
160
160
|
/**
|
|
@@ -168,7 +168,13 @@ export type FilterKeyValueTupleFunction<T extends object = object, K extends key
|
|
|
168
168
|
* (undefined, null, falsy, empty), key filtering, and inversion.
|
|
169
169
|
*
|
|
170
170
|
* @param inputFilter - Filter configuration (enum value or full config object)
|
|
171
|
-
* @returns A predicate function that tests individual key/value tuples
|
|
171
|
+
* @returns A predicate function that tests individual key/value tuples.
|
|
172
|
+
*
|
|
173
|
+
* @dbxUtil
|
|
174
|
+
* @dbxUtilCategory object
|
|
175
|
+
* @dbxUtilKind factory
|
|
176
|
+
* @dbxUtilTags object, tuple, filter, predicate, factory, key-value
|
|
177
|
+
* @dbxUtilRelated filter-key-value-tuples-function
|
|
172
178
|
*
|
|
173
179
|
* @example
|
|
174
180
|
* ```ts
|
|
@@ -177,12 +183,6 @@ export type FilterKeyValueTupleFunction<T extends object = object, K extends key
|
|
|
177
183
|
* isNotNull(['b', null], 0); // false
|
|
178
184
|
* ```
|
|
179
185
|
*
|
|
180
|
-
* @dbxUtil
|
|
181
|
-
* @dbxUtilCategory object
|
|
182
|
-
* @dbxUtilKind factory
|
|
183
|
-
* @dbxUtilTags object, tuple, filter, predicate, factory, key-value
|
|
184
|
-
* @dbxUtilRelated filter-key-value-tuples-function
|
|
185
|
-
*
|
|
186
186
|
* @__NO_SIDE_EFFECTS__
|
|
187
187
|
*/
|
|
188
188
|
export declare function filterKeyValueTupleFunction<T extends object = object, K extends keyof T = keyof T>(inputFilter: FilterKeyValueTuplesInput<T, K>): FilterKeyValueTupleFunction<T, K>;
|
|
@@ -24,6 +24,10 @@ export interface FlattenObjectConfig {
|
|
|
24
24
|
* Empty nested objects are omitted from the result (they produce no keys).
|
|
25
25
|
* Circular references are detected and treated as leaf values to avoid infinite recursion.
|
|
26
26
|
*
|
|
27
|
+
* @param input - The object to flatten. If nullish, returns an empty object.
|
|
28
|
+
* @param config - Optional configuration for separator and max depth.
|
|
29
|
+
* @returns A new flat object with concatenated key paths.
|
|
30
|
+
*
|
|
27
31
|
* @dbxUtil
|
|
28
32
|
* @dbxUtilCategory object
|
|
29
33
|
* @dbxUtilTags object, flatten, flat, nested, dot-notation, deep, traverse
|
|
@@ -39,9 +43,5 @@ export interface FlattenObjectConfig {
|
|
|
39
43
|
* flattenObject({ a: { b: { c: 1 } } }, { maxDepth: 1 });
|
|
40
44
|
* // { 'a.b': { c: 1 } }
|
|
41
45
|
* ```
|
|
42
|
-
*
|
|
43
|
-
* @param input - The object to flatten. If nullish, returns an empty object.
|
|
44
|
-
* @param config - Optional configuration for separator and max depth.
|
|
45
|
-
* @returns A new flat object with concatenated key paths.
|
|
46
46
|
*/
|
|
47
47
|
export declare function flattenObject(input: Maybe<Record<string, unknown>>, config?: FlattenObjectConfig): Record<string, unknown>;
|