@dereekb/util 13.11.13 → 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
package/src/lib/value/maybe.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { type Maybe, type MaybeNot, type MaybeSo } from './maybe.type';
|
|
|
2
2
|
/**
|
|
3
3
|
* Type guard that returns `true` if the value is not `null` or `undefined`.
|
|
4
4
|
*
|
|
5
|
+
* @param value - The value to check.
|
|
6
|
+
* @returns `true` if the value is not `null` or `undefined`
|
|
7
|
+
*
|
|
5
8
|
* @dbxUtil
|
|
6
9
|
* @dbxUtilCategory value
|
|
7
10
|
* @dbxUtilTags maybe, nullish, type-guard, defined, not-null, value
|
|
8
11
|
* @dbxUtilRelated is-maybe-so, is-maybe-not, has-value-or-not-empty
|
|
9
|
-
*
|
|
10
|
-
* @param value - the value to check
|
|
11
|
-
* @returns `true` if the value is not `null` or `undefined`
|
|
12
12
|
*/
|
|
13
13
|
export declare function hasNonNullValue<T = unknown>(value: Maybe<T>): value is MaybeSo<T>;
|
|
14
14
|
/**
|
|
@@ -20,13 +20,13 @@ export declare function hasNonNullValue<T = unknown>(value: Maybe<T>): value is
|
|
|
20
20
|
*
|
|
21
21
|
* NaN has undefined behavior.
|
|
22
22
|
*
|
|
23
|
+
* @param value - The value to check.
|
|
24
|
+
* @returns `true` if the value is non-nullish and not empty.
|
|
25
|
+
*
|
|
23
26
|
* @dbxUtil
|
|
24
27
|
* @dbxUtilCategory value
|
|
25
28
|
* @dbxUtilTags maybe, empty, type-guard, non-empty, value, has-value
|
|
26
29
|
* @dbxUtilRelated has-value-or-not-empty-object, has-non-null-value, is-not-null-or-empty-string
|
|
27
|
-
*
|
|
28
|
-
* @param value - the value to check
|
|
29
|
-
* @returns `true` if the value is non-nullish and not empty
|
|
30
30
|
*/
|
|
31
31
|
export declare function hasValueOrNotEmpty<T = unknown>(value: Maybe<T>): value is MaybeSo<T>;
|
|
32
32
|
/**
|
|
@@ -37,19 +37,19 @@ export declare function hasValueOrNotEmpty<T = unknown>(value: Maybe<T>): value
|
|
|
37
37
|
*
|
|
38
38
|
* NaN has undefined behavior.
|
|
39
39
|
*
|
|
40
|
+
* @param value - The value to check.
|
|
41
|
+
* @returns `true` if the value is non-nullish, non-empty, and not an empty object.
|
|
42
|
+
*
|
|
40
43
|
* @dbxUtil
|
|
41
44
|
* @dbxUtilCategory value
|
|
42
45
|
* @dbxUtilTags maybe, empty, type-guard, object, non-empty, strict
|
|
43
46
|
* @dbxUtilRelated has-value-or-not-empty, has-non-null-value, object-has-no-keys
|
|
44
|
-
*
|
|
45
|
-
* @param value - the value to check
|
|
46
|
-
* @returns `true` if the value is non-nullish, non-empty, and not an empty object
|
|
47
47
|
*/
|
|
48
48
|
export declare function hasValueOrNotEmptyObject<T = unknown>(value: Maybe<T>): value is MaybeSo<T>;
|
|
49
49
|
/**
|
|
50
50
|
* Returns `true` if the input value is a non-empty string or is `true`.
|
|
51
51
|
*
|
|
52
|
-
* @param value -
|
|
52
|
+
* @param value - The value to check.
|
|
53
53
|
* @returns `true` if the value is a non-empty string or is `true`
|
|
54
54
|
*/
|
|
55
55
|
export declare function isStringOrTrue(value: Maybe<string | boolean>): boolean;
|
|
@@ -58,25 +58,25 @@ export declare function isStringOrTrue(value: Maybe<string | boolean>): boolean;
|
|
|
58
58
|
*
|
|
59
59
|
* Useful for filtering out both nullish values and empty strings in a single check.
|
|
60
60
|
*
|
|
61
|
+
* @param value - The value to check.
|
|
62
|
+
* @returns `true` if the value is not nullish and not an empty string.
|
|
63
|
+
*
|
|
61
64
|
* @dbxUtil
|
|
62
65
|
* @dbxUtilCategory value
|
|
63
66
|
* @dbxUtilTags maybe, string, empty, type-guard, nullish, non-empty
|
|
64
67
|
* @dbxUtilRelated has-value-or-not-empty, has-non-null-value
|
|
65
|
-
*
|
|
66
|
-
* @param value - the value to check
|
|
67
|
-
* @returns `true` if the value is not nullish and not an empty string
|
|
68
68
|
*/
|
|
69
69
|
export declare function isNotNullOrEmptyString<T>(value: Maybe<MaybeNot | '' | T>): value is MaybeSo<T>;
|
|
70
70
|
/**
|
|
71
71
|
* Type guard that returns `true` if the input is `null` or `undefined`.
|
|
72
72
|
*
|
|
73
|
+
* @param value - The value to check.
|
|
74
|
+
* @returns `true` if the value is `null` or `undefined`
|
|
75
|
+
*
|
|
73
76
|
* @dbxUtil
|
|
74
77
|
* @dbxUtilCategory value
|
|
75
78
|
* @dbxUtilTags maybe, nullish, type-guard, null, undefined, missing
|
|
76
79
|
* @dbxUtilRelated is-maybe-so, has-non-null-value
|
|
77
|
-
*
|
|
78
|
-
* @param value - the value to check
|
|
79
|
-
* @returns `true` if the value is `null` or `undefined`
|
|
80
80
|
*/
|
|
81
81
|
export declare function isMaybeNot<T = unknown>(value: Maybe<T>): value is MaybeNot;
|
|
82
82
|
/**
|
|
@@ -84,13 +84,13 @@ export declare function isMaybeNot<T = unknown>(value: Maybe<T>): value is Maybe
|
|
|
84
84
|
*
|
|
85
85
|
* Equivalent to {@link hasNonNullValue} but with the `MaybeSo` narrowing type.
|
|
86
86
|
*
|
|
87
|
+
* @param value - The value to check.
|
|
88
|
+
* @returns `true` if the value is neither `null` nor `undefined`
|
|
89
|
+
*
|
|
87
90
|
* @dbxUtil
|
|
88
91
|
* @dbxUtilCategory value
|
|
89
92
|
* @dbxUtilTags maybe, nullish, type-guard, defined, present, non-null
|
|
90
93
|
* @dbxUtilRelated is-maybe-not, has-non-null-value
|
|
91
|
-
*
|
|
92
|
-
* @param value - the value to check
|
|
93
|
-
* @returns `true` if the value is neither `null` nor `undefined`
|
|
94
94
|
*/
|
|
95
95
|
export declare function isMaybeSo<T>(value: Maybe<T>): value is MaybeSo<T>;
|
|
96
96
|
/**
|
|
@@ -98,40 +98,40 @@ export declare function isMaybeSo<T>(value: Maybe<T>): value is MaybeSo<T>;
|
|
|
98
98
|
*
|
|
99
99
|
* Useful for optional boolean flags where both absence and `true` indicate the same behavior.
|
|
100
100
|
*
|
|
101
|
-
* @param value -
|
|
101
|
+
* @param value - The value to check.
|
|
102
102
|
* @returns `true` if the value is nullish or strictly `true`
|
|
103
103
|
*/
|
|
104
104
|
export declare function isMaybeNotOrTrue<T = unknown>(value: Maybe<T | true>): value is MaybeNot | true;
|
|
105
105
|
/**
|
|
106
106
|
* Returns `true` if the input is not `null`, `undefined`, or `false`.
|
|
107
107
|
*
|
|
108
|
+
* @param value - The value to check.
|
|
109
|
+
* @returns `true` if the value is not `null`, `undefined`, or `false`
|
|
110
|
+
*
|
|
108
111
|
* @dbxUtil
|
|
109
112
|
* @dbxUtilCategory value
|
|
110
113
|
* @dbxUtilTags maybe, boolean, defined, truthy, type-guard
|
|
111
114
|
* @dbxUtilRelated is-not-false, has-non-null-value
|
|
112
|
-
*
|
|
113
|
-
* @param value - the value to check
|
|
114
|
-
* @returns `true` if the value is not `null`, `undefined`, or `false`
|
|
115
115
|
*/
|
|
116
116
|
export declare function isDefinedAndNotFalse<T = unknown>(value: Maybe<T>): boolean;
|
|
117
117
|
/**
|
|
118
118
|
* Returns `true` if the input is not strictly `false`. Nullish values return `true`.
|
|
119
119
|
*
|
|
120
|
-
* @param value -
|
|
120
|
+
* @param value - The value to check.
|
|
121
121
|
* @returns `true` if the value is not strictly `false`
|
|
122
122
|
*/
|
|
123
123
|
export declare function isNotFalse<T = unknown>(value: Maybe<T>): boolean;
|
|
124
124
|
/**
|
|
125
125
|
* Returns `true` if both inputs are non-nullish and strictly equal (`===`).
|
|
126
126
|
*
|
|
127
|
+
* @param a - First value.
|
|
128
|
+
* @param b - Second value.
|
|
129
|
+
* @returns `true` if both values are non-nullish and strictly equal.
|
|
130
|
+
*
|
|
127
131
|
* @dbxUtil
|
|
128
132
|
* @dbxUtilCategory value
|
|
129
133
|
* @dbxUtilTags maybe, equal, equality, compare, non-null
|
|
130
134
|
* @dbxUtilRelated values-are-both-nullish-or-equivalent, has-non-null-value
|
|
131
|
-
*
|
|
132
|
-
* @param a - first value
|
|
133
|
-
* @param b - second value
|
|
134
|
-
* @returns `true` if both values are non-nullish and strictly equal
|
|
135
135
|
*/
|
|
136
136
|
export declare function isSameNonNullValue<T>(a: Maybe<T>, b: Maybe<T>): a is NonNullable<T>;
|
|
137
137
|
/**
|
|
@@ -139,14 +139,14 @@ export declare function isSameNonNullValue<T>(a: Maybe<T>, b: Maybe<T>): a is No
|
|
|
139
139
|
*
|
|
140
140
|
* This means `null` and `undefined` are considered equivalent to each other, but `false` and `null` are not.
|
|
141
141
|
*
|
|
142
|
+
* @param a - First value.
|
|
143
|
+
* @param b - Second value.
|
|
144
|
+
* @returns `true` if both are nullish or both are the same value.
|
|
145
|
+
*
|
|
142
146
|
* @dbxUtil
|
|
143
147
|
* @dbxUtilCategory value
|
|
144
148
|
* @dbxUtilTags maybe, equal, equality, nullish, compare
|
|
145
149
|
* @dbxUtilRelated is-same-non-null-value
|
|
146
|
-
*
|
|
147
|
-
* @param a - first value
|
|
148
|
-
* @param b - second value
|
|
149
|
-
* @returns `true` if both are nullish or both are the same value
|
|
150
150
|
*/
|
|
151
151
|
export declare function valuesAreBothNullishOrEquivalent<T>(a: Maybe<T>, b: Maybe<T>): boolean;
|
|
152
152
|
/**
|
|
@@ -156,12 +156,12 @@ export declare function valuesAreBothNullishOrEquivalent<T>(a: Maybe<T>, b: Mayb
|
|
|
156
156
|
* - If `b` is `null`, returns `null` (explicit clear).
|
|
157
157
|
* - If `b` is defined, returns `b` (new value).
|
|
158
158
|
*
|
|
159
|
+
* @param a - The current value.
|
|
160
|
+
* @param b - The update value.
|
|
161
|
+
* @returns `a` if `b` is undefined, otherwise `b`
|
|
162
|
+
*
|
|
159
163
|
* @dbxUtil
|
|
160
164
|
* @dbxUtilCategory value
|
|
161
165
|
* @dbxUtilTags maybe, update, merge, sentinel, patch, optional
|
|
162
|
-
*
|
|
163
|
-
* @param a - the current value
|
|
164
|
-
* @param b - the update value
|
|
165
|
-
* @returns `a` if `b` is undefined, otherwise `b`
|
|
166
166
|
*/
|
|
167
167
|
export declare function updateMaybeValue<T>(a: Maybe<T>, b: Maybe<T>): Maybe<T>;
|
|
@@ -32,9 +32,9 @@ export interface Modifier<T> extends ModifierFunctionRef<T> {
|
|
|
32
32
|
/**
|
|
33
33
|
* Creates a {@link Modifier} with the given key and modify function.
|
|
34
34
|
*
|
|
35
|
-
* @param key -
|
|
36
|
-
* @param modify -
|
|
37
|
-
* @returns
|
|
35
|
+
* @param key - Unique identifier for the modifier.
|
|
36
|
+
* @param modify - Function that mutates the target value.
|
|
37
|
+
* @returns A new {@link Modifier} pairing the key with the modify function.
|
|
38
38
|
*
|
|
39
39
|
* @dbxUtil
|
|
40
40
|
* @dbxUtilCategory value
|
|
@@ -53,7 +53,7 @@ export declare function modifier<T>(key: string, modify: ModifierFunction<T>): M
|
|
|
53
53
|
/**
|
|
54
54
|
* A no-operation modifier that does nothing to the input. Useful as a default/fallback.
|
|
55
55
|
*
|
|
56
|
-
* @returns
|
|
56
|
+
* @returns Undefined (no mutation is performed)
|
|
57
57
|
*/
|
|
58
58
|
export declare const NOOP_MODIFIER: ModifierFunction<any>;
|
|
59
59
|
/**
|
|
@@ -65,9 +65,9 @@ export type ModifierMap<T> = Map<ModifierKey, Modifier<T>>;
|
|
|
65
65
|
*
|
|
66
66
|
* If a modifier with the same key already exists, it is replaced.
|
|
67
67
|
*
|
|
68
|
-
* @param modifiers -
|
|
69
|
-
* @param map -
|
|
70
|
-
* @returns
|
|
68
|
+
* @param modifiers - Modifier(s) to add.
|
|
69
|
+
* @param map - Existing map to add to, or undefined to create a new one.
|
|
70
|
+
* @returns The modifier map with the new modifiers added.
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* ```ts
|
|
@@ -80,9 +80,9 @@ export declare function addModifiers<T>(modifiers: ArrayOrValue<Modifier<T>>, ma
|
|
|
80
80
|
/**
|
|
81
81
|
* Removes one or more modifiers from the map by key. Returns an empty map if no map is provided.
|
|
82
82
|
*
|
|
83
|
-
* @param modifiers -
|
|
84
|
-
* @param map -
|
|
85
|
-
* @returns
|
|
83
|
+
* @param modifiers - Modifier(s) whose keys should be removed.
|
|
84
|
+
* @param map - The map to remove from.
|
|
85
|
+
* @returns The modifier map with the specified modifiers removed.
|
|
86
86
|
*
|
|
87
87
|
* @example
|
|
88
88
|
* ```ts
|
|
@@ -98,8 +98,13 @@ export declare function removeModifiers<T>(modifiers: ArrayOrValue<Modifier<T>>,
|
|
|
98
98
|
*
|
|
99
99
|
* Returns {@link NOOP_MODIFIER} if the map is nullish or empty.
|
|
100
100
|
*
|
|
101
|
-
* @param map -
|
|
102
|
-
* @returns
|
|
101
|
+
* @param map - The modifier map to convert.
|
|
102
|
+
* @returns A single modifier function that applies all mapped modifiers, or {@link NOOP_MODIFIER} if empty.
|
|
103
|
+
*
|
|
104
|
+
* @dbxUtil
|
|
105
|
+
* @dbxUtilCategory value
|
|
106
|
+
* @dbxUtilTags modifier, map, factory, compose
|
|
107
|
+
* @dbxUtilRelated maybe-modifier-map-to-function, modifier
|
|
103
108
|
*
|
|
104
109
|
* @example
|
|
105
110
|
* ```ts
|
|
@@ -111,11 +116,6 @@ export declare function removeModifiers<T>(modifiers: ArrayOrValue<Modifier<T>>,
|
|
|
111
116
|
* // obj.x === 1
|
|
112
117
|
* ```
|
|
113
118
|
*
|
|
114
|
-
* @dbxUtil
|
|
115
|
-
* @dbxUtilCategory value
|
|
116
|
-
* @dbxUtilTags modifier, map, factory, compose
|
|
117
|
-
* @dbxUtilRelated maybe-modifier-map-to-function, modifier
|
|
118
|
-
*
|
|
119
119
|
* @__NO_SIDE_EFFECTS__
|
|
120
120
|
*/
|
|
121
121
|
export declare function modifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): ModifierFunction<T>;
|
|
@@ -124,13 +124,14 @@ export declare function modifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): Mo
|
|
|
124
124
|
*
|
|
125
125
|
* Returns undefined if no map is provided, allowing callers to distinguish "no modifiers" from "empty modifiers".
|
|
126
126
|
*
|
|
127
|
+
* @param map - The modifier map to convert.
|
|
128
|
+
* @returns A composed modifier function, or `undefined` if no map is provided.
|
|
129
|
+
*
|
|
127
130
|
* @dbxUtil
|
|
128
131
|
* @dbxUtilCategory value
|
|
129
132
|
* @dbxUtilTags modifier, map, factory, compose, optional
|
|
130
133
|
* @dbxUtilRelated modifier-map-to-function, modifier
|
|
131
134
|
*
|
|
132
|
-
* @param map - the modifier map to convert
|
|
133
|
-
* @returns a composed modifier function, or `undefined` if no map is provided
|
|
134
135
|
* @__NO_SIDE_EFFECTS__
|
|
135
136
|
*/
|
|
136
137
|
export declare function maybeModifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): Maybe<ModifierFunction<T>>;
|
|
@@ -139,8 +140,8 @@ export declare function maybeModifierMapToFunction<T>(map: Maybe<ModifierMap<T>>
|
|
|
139
140
|
*
|
|
140
141
|
* Returns {@link NOOP_MODIFIER} if the array is empty or nullish.
|
|
141
142
|
*
|
|
142
|
-
* @param modifiers -
|
|
143
|
-
* @returns
|
|
143
|
+
* @param modifiers - Array of modifier functions to merge.
|
|
144
|
+
* @returns A single modifier function that applies all provided modifiers, or {@link NOOP_MODIFIER} if empty.
|
|
144
145
|
*
|
|
145
146
|
* @example
|
|
146
147
|
* ```ts
|
|
@@ -158,7 +159,7 @@ export declare function mergeModifiers<T>(modifiers: ModifierFunction<T>[]): Mod
|
|
|
158
159
|
*
|
|
159
160
|
* If only one modifier is provided, returns it directly without wrapping.
|
|
160
161
|
*
|
|
161
|
-
* @param modifiers -
|
|
162
|
-
* @returns
|
|
162
|
+
* @param modifiers - Array of modifier functions to merge, or undefined.
|
|
163
|
+
* @returns A composed modifier function, the single modifier if only one provided, or `undefined` if input is nullish.
|
|
163
164
|
*/
|
|
164
165
|
export declare function maybeMergeModifiers<T>(modifiers: Maybe<ModifierFunction<T>[]>): Maybe<ModifierFunction<T>>;
|