@dereekb/util 13.11.2 → 13.11.4
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 +687 -0
- package/eslint/index.cjs.mjs +2 -0
- package/eslint/index.d.ts +1 -0
- package/eslint/index.esm.js +683 -0
- package/eslint/package.json +23 -0
- package/eslint/src/index.d.ts +1 -0
- package/eslint/src/lib/comments.d.ts +101 -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 +50 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +67 -0
- package/fetch/package.json +2 -2
- package/index.cjs.js +1421 -23
- package/index.esm.js +1421 -24
- 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 +229 -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.4",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./test": {
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"import": "./fetch/index.cjs.mjs",
|
|
16
16
|
"default": "./fetch/index.cjs.js"
|
|
17
17
|
},
|
|
18
|
+
"./eslint": {
|
|
19
|
+
"module": "./eslint/index.esm.js",
|
|
20
|
+
"types": "./eslint/index.d.ts",
|
|
21
|
+
"import": "./eslint/index.cjs.mjs",
|
|
22
|
+
"default": "./eslint/index.cjs.js"
|
|
23
|
+
},
|
|
18
24
|
"./package.json": "./package.json",
|
|
19
25
|
".": {
|
|
20
26
|
"module": "./index.esm.js",
|
|
@@ -29,6 +29,7 @@ export type AsyncArrayInputFactory<I, O> = AsyncMapFunction<ArrayInputFactory<I,
|
|
|
29
29
|
*
|
|
30
30
|
* @param factory - The factory function used to generate each item
|
|
31
31
|
* @returns A function that takes a count parameter and returns an array of generated items
|
|
32
|
+
* @__NO_SIDE_EFFECTS__
|
|
32
33
|
*/
|
|
33
34
|
export declare function arrayFactory<T>(factory: Factory<T> | FactoryWithIndex<T>): ArrayFactory<T>;
|
|
34
35
|
/**
|
|
@@ -42,6 +43,7 @@ export declare function arrayFactory<T>(factory: Factory<T> | FactoryWithIndex<T
|
|
|
42
43
|
*
|
|
43
44
|
* @param factory - The factory function used to transform each input value
|
|
44
45
|
* @returns A function that takes an array of input values and returns an array of output values
|
|
46
|
+
* @__NO_SIDE_EFFECTS__
|
|
45
47
|
*/
|
|
46
48
|
export declare function arrayInputFactory<O, I>(factory: FactoryWithRequiredInput<O, I>): ArrayInputFactory<I, O>;
|
|
47
49
|
/**
|
|
@@ -5,14 +5,16 @@ import { type AscendingSortCompareFunction } from '../sort';
|
|
|
5
5
|
* Filters the input values by distance while maintaining the original order of elements.
|
|
6
6
|
* Values that are too close to each other (based on the minDistance parameter) will be filtered out.
|
|
7
7
|
*
|
|
8
|
+
* Items whose extracted value is null are excluded from the result.
|
|
9
|
+
*
|
|
8
10
|
* If order is irrelevant, use filterValuesByDistanceNoOrder() instead.
|
|
9
11
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @returns A filtered array with only values that are at least minDistance apart
|
|
12
|
+
* @param input - The array of values to filter
|
|
13
|
+
* @param minDistance - The minimum distance required between values (inclusive)
|
|
14
|
+
* @param getValue - Function that extracts a numeric value from each item for distance comparison
|
|
15
|
+
* @returns A filtered array with only values that are at least minDistance apart, in their original input order
|
|
14
16
|
*/
|
|
15
|
-
export declare function filterValuesByDistance<T>(
|
|
17
|
+
export declare function filterValuesByDistance<T>(input: T[], minDistance: number, getValue: (value: T) => number | null): T[];
|
|
16
18
|
/**
|
|
17
19
|
* Filters the input values by an arbitrary "distance"/difference from each other and returns the values sorted by their determined distance.
|
|
18
20
|
*
|
|
@@ -25,29 +27,53 @@ export declare function filterValuesByDistance<T>(_input: T[], _minDistance: num
|
|
|
25
27
|
* @returns A filtered array with only values that are at least minDistance apart, sorted by the extracted value
|
|
26
28
|
*/
|
|
27
29
|
export declare function filterValuesByDistanceNoOrder<T>(input: T[], minDistance: number, getValue: (value: T) => number | null): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Strategy used by {@link applyBestFit} and {@link makeBestFit} to pick the best-fit item and transform the rest.
|
|
32
|
+
*/
|
|
33
|
+
export interface BestFitConfig<T> {
|
|
34
|
+
/**
|
|
35
|
+
* Function that determines which items are candidates for the best fit.
|
|
36
|
+
*/
|
|
37
|
+
readonly filter: (value: T) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* AscendingSortCompareFunction to compare two values to determine which is the best fit.
|
|
40
|
+
*/
|
|
41
|
+
readonly compare: AscendingSortCompareFunction<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Function that transforms non-best-fit items.
|
|
44
|
+
*/
|
|
45
|
+
readonly updateNonBestFit: (value: T) => T;
|
|
46
|
+
}
|
|
28
47
|
/**
|
|
29
48
|
* Same as applyBestFit, but returns a new array, rather than modifying the existing array.
|
|
30
49
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
35
|
-
*
|
|
50
|
+
* @dbxUtil
|
|
51
|
+
* @dbxUtilCategory array
|
|
52
|
+
* @dbxUtilTags array, best-fit, filter, sort, immutable
|
|
53
|
+
* @dbxUtilRelated apply-best-fit, find-best-index-set-pair
|
|
54
|
+
*
|
|
55
|
+
* @param input - The array to filter for the best fit.
|
|
56
|
+
* @param config - The best-fit strategy ({@link BestFitConfig}).
|
|
57
|
+
* @returns A new array with only the best fit item and transformed non-best-fit items.
|
|
58
|
+
* @__NO_SIDE_EFFECTS__
|
|
36
59
|
*/
|
|
37
|
-
export declare function makeBestFit<T>(input: T[],
|
|
60
|
+
export declare function makeBestFit<T>(input: T[], config: BestFitConfig<T>): T[];
|
|
38
61
|
/**
|
|
39
62
|
* Used for updating an array so that a single element becomes the "best fit" in whatever context is provided.
|
|
40
63
|
*
|
|
41
64
|
* For instance, if two items are selected but only one can be selected by design, this function can be used to
|
|
42
65
|
* pick the best fit, and update the input array.
|
|
43
66
|
*
|
|
44
|
-
* @
|
|
45
|
-
* @
|
|
46
|
-
* @
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
67
|
+
* @dbxUtil
|
|
68
|
+
* @dbxUtilCategory array
|
|
69
|
+
* @dbxUtilTags array, best-fit, filter, sort, mutable, in-place
|
|
70
|
+
* @dbxUtilRelated make-best-fit, find-best-index-set-pair
|
|
71
|
+
*
|
|
72
|
+
* @param input - The array to modify in-place.
|
|
73
|
+
* @param config - The best-fit strategy ({@link BestFitConfig}).
|
|
74
|
+
* @returns The modified input array with only the best fit item and transformed non-best-fit items.
|
|
49
75
|
*/
|
|
50
|
-
export declare function applyBestFit<T>(input: T[],
|
|
76
|
+
export declare function applyBestFit<T>(input: T[], config: BestFitConfig<T>): T[];
|
|
51
77
|
/**
|
|
52
78
|
* Filters and maps the input values to an array.
|
|
53
79
|
* Combines filtering and mapping operations into a single pass over the data.
|
|
@@ -57,8 +83,15 @@ export type FilterAndMapFunction<I, O> = MapFunction<Iterable<I>, O[]>;
|
|
|
57
83
|
* Creates a function that filters the input values and maps all matching values to a new value.
|
|
58
84
|
* This is a higher-order function that combines filtering and mapping operations.
|
|
59
85
|
*
|
|
86
|
+
* @dbxUtil
|
|
87
|
+
* @dbxUtilCategory array
|
|
88
|
+
* @dbxUtilKind factory
|
|
89
|
+
* @dbxUtilTags array, filter, map, transform, factory, iterable
|
|
90
|
+
* @dbxUtilRelated array-decision-function
|
|
91
|
+
*
|
|
60
92
|
* @param decisionFunction - Function that determines which items to include in the result
|
|
61
93
|
* @param mapFunction - Function that transforms each included item
|
|
62
94
|
* @returns A function that takes an iterable of input values and returns an array of transformed values
|
|
95
|
+
* @__NO_SIDE_EFFECTS__
|
|
63
96
|
*/
|
|
64
97
|
export declare function filterAndMapFunction<I, O>(decisionFunction: DecisionFunction<I>, mapFunction: MapFunction<I, O>): FilterAndMapFunction<I, O>;
|
|
@@ -22,6 +22,7 @@ export type ArrayDecisionFunction<T> = (values: T[]) => boolean;
|
|
|
22
22
|
* @param decision - Predicate used to test individual elements.
|
|
23
23
|
* @param mode - Whether all or any elements must satisfy the predicate.
|
|
24
24
|
* @returns A function that evaluates an array against the configured decision criteria.
|
|
25
|
+
* @__NO_SIDE_EFFECTS__
|
|
25
26
|
*/
|
|
26
27
|
export declare function arrayDecisionFunction<T>(decision: ArrayFindDecisionFunction<T>, mode: SetIncludesMode): ArrayDecisionFunction<T>;
|
|
27
28
|
/**
|
|
@@ -67,7 +67,14 @@ export type SliceIndexRangeFunction<T> = (input: T[]) => T[];
|
|
|
67
67
|
/**
|
|
68
68
|
* Creates a {@link SliceIndexRangeFunction} that slices the specified index range from any input array.
|
|
69
69
|
*
|
|
70
|
+
* @dbxUtil
|
|
71
|
+
* @dbxUtilCategory array
|
|
72
|
+
* @dbxUtilKind factory
|
|
73
|
+
* @dbxUtilTags array, slice, index, range, factory
|
|
74
|
+
* @dbxUtilRelated index-range, find-to-index-set
|
|
75
|
+
*
|
|
70
76
|
* @param inputRange - the index range configuration to use for slicing
|
|
71
77
|
* @returns a function that slices the configured range from an input array
|
|
78
|
+
* @__NO_SIDE_EFFECTS__
|
|
72
79
|
*/
|
|
73
80
|
export declare function sliceIndexRangeFunction<T>(inputRange: IndexRangeInput): SliceIndexRangeFunction<T>;
|
|
@@ -46,8 +46,15 @@ export type RangedIndexedValuesArrayAccessorFactory<T> = (values: T[]) => Ranged
|
|
|
46
46
|
*
|
|
47
47
|
* Each accessor maps an index to the value whose range contains that index, or undefined if no range matches.
|
|
48
48
|
*
|
|
49
|
+
* @dbxUtil
|
|
50
|
+
* @dbxUtilCategory array
|
|
51
|
+
* @dbxUtilKind factory
|
|
52
|
+
* @dbxUtilTags array, indexed, range, accessor, factory, lookup
|
|
53
|
+
* @dbxUtilRelated indexed-values-array-accessor-factory, ranged-indexed-values-array-accessor-info-factory
|
|
54
|
+
*
|
|
49
55
|
* @param readIndexRange - Function that reads the index range from each value.
|
|
50
56
|
* @returns A factory that creates ranged accessors from arrays of values.
|
|
57
|
+
* @__NO_SIDE_EFFECTS__
|
|
51
58
|
*/
|
|
52
59
|
export declare function rangedIndexedValuesArrayAccessorFactory<T>(readIndexRange: ReadIndexRangeFunction<T>): RangedIndexedValuesArrayAccessorFactory<T>;
|
|
53
60
|
/**
|
|
@@ -64,9 +71,16 @@ export type IndexedValuesArrayAccessorFactory<T> = (values: T[]) => IndexedValue
|
|
|
64
71
|
* Each accessor maps an index to the matching value, falling back to the previous value, then the next value.
|
|
65
72
|
* This guarantees a value is always returned.
|
|
66
73
|
*
|
|
74
|
+
* @dbxUtil
|
|
75
|
+
* @dbxUtilCategory array
|
|
76
|
+
* @dbxUtilKind factory
|
|
77
|
+
* @dbxUtilTags array, indexed, range, accessor, factory, fallback
|
|
78
|
+
* @dbxUtilRelated ranged-indexed-values-array-accessor-factory, ranged-indexed-values-array-accessor-info-factory
|
|
79
|
+
*
|
|
67
80
|
* @param readIndexRange - Function that reads the index range from each value.
|
|
68
81
|
* @returns A factory that creates indexed accessors from arrays of values.
|
|
69
82
|
* @throws Error if the provided values array is empty.
|
|
83
|
+
* @__NO_SIDE_EFFECTS__
|
|
70
84
|
*/
|
|
71
85
|
export declare function indexedValuesArrayAccessorFactory<T>(readIndexRange: ReadIndexRangeFunction<T>): IndexedValuesArrayAccessorFactory<T>;
|
|
72
86
|
/**
|
|
@@ -109,7 +123,14 @@ export interface RangedIndexedValuesArrayInfoAccessorFactoryConfig<T> {
|
|
|
109
123
|
* Each accessor sorts the values by their index ranges in ascending order, then for a given index
|
|
110
124
|
* returns the matching value along with its previous and next neighbors.
|
|
111
125
|
*
|
|
126
|
+
* @dbxUtil
|
|
127
|
+
* @dbxUtilCategory array
|
|
128
|
+
* @dbxUtilKind factory
|
|
129
|
+
* @dbxUtilTags array, indexed, range, accessor, info, factory, neighbors
|
|
130
|
+
* @dbxUtilRelated ranged-indexed-values-array-accessor-factory, indexed-values-array-accessor-factory
|
|
131
|
+
*
|
|
112
132
|
* @param config - Configuration containing the index range reader function.
|
|
113
133
|
* @returns A factory that creates ranged info accessors from arrays of values.
|
|
134
|
+
* @__NO_SIDE_EFFECTS__
|
|
114
135
|
*/
|
|
115
136
|
export declare function rangedIndexedValuesArrayAccessorInfoFactory<T>(config: RangedIndexedValuesArrayInfoAccessorFactoryConfig<T>): RangedIndexedValuesArrayInfoAccessorFactory<T>;
|
|
@@ -23,7 +23,14 @@ export type RandomArrayFactory<T> = FactoryWithInput<T[], number>;
|
|
|
23
23
|
/**
|
|
24
24
|
* Creates a factory function that generates arrays of a random length populated with items from a make function.
|
|
25
25
|
*
|
|
26
|
+
* @dbxUtil
|
|
27
|
+
* @dbxUtilCategory array
|
|
28
|
+
* @dbxUtilKind factory
|
|
29
|
+
* @dbxUtilTags array, random, factory, generate, make
|
|
30
|
+
* @dbxUtilRelated array-factory, random-number-factory
|
|
31
|
+
*
|
|
26
32
|
* @param config - configuration containing the make function and random number source
|
|
27
33
|
* @returns a factory that produces arrays of random length, optionally accepting a specific count override
|
|
34
|
+
* @__NO_SIDE_EFFECTS__
|
|
28
35
|
*/
|
|
29
36
|
export declare function randomArrayFactory<T>(config: RandomArrayFactoryConfig<T>): RandomArrayFactory<T>;
|
|
@@ -20,6 +20,7 @@ export type RandomPickFactory<T> = (() => T) & {
|
|
|
20
20
|
* @param values - array of values to randomly pick from
|
|
21
21
|
* @returns a callable factory that returns a random value from the array on each invocation
|
|
22
22
|
* @throws Error if the input array is empty
|
|
23
|
+
* @__NO_SIDE_EFFECTS__
|
|
23
24
|
*/
|
|
24
25
|
export declare function randomPickFactory<T>(values: T[]): RandomPickFactory<T>;
|
|
25
26
|
/**
|
|
@@ -87,6 +87,7 @@ export declare function readKeysFromFilterUniqueFunctionAdditionalKeys<T, K exte
|
|
|
87
87
|
* @param readKey - Function to extract a unique key from each item.
|
|
88
88
|
* @param additionalKeysInput - Optional keys or values to pre-seed as already seen, causing them to be excluded.
|
|
89
89
|
* @returns A reusable filter function that removes duplicate items from arrays.
|
|
90
|
+
* @__NO_SIDE_EFFECTS__
|
|
90
91
|
*/
|
|
91
92
|
export declare function filterUniqueFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K>, additionalKeysInput?: FilterUniqueFunctionAdditionalKeysInput<T, K>): FilterUniqueFunction<T, K>;
|
|
92
93
|
/**
|
|
@@ -118,6 +119,7 @@ export type IsUniqueKeyedFunction<T> = DecisionFunction<T[]>;
|
|
|
118
119
|
*
|
|
119
120
|
* @param readKey - Function to extract a unique key from each item.
|
|
120
121
|
* @returns A decision function that returns true if all items have distinct keys.
|
|
122
|
+
* @__NO_SIDE_EFFECTS__
|
|
121
123
|
*/
|
|
122
124
|
export declare function isUniqueKeyedFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K>): IsUniqueKeyedFunction<T>;
|
|
123
125
|
/**
|
|
@@ -144,6 +146,7 @@ export type AllowValueOnceFilter<T, K extends PrimativeKey = PrimativeKey> = Dec
|
|
|
144
146
|
*
|
|
145
147
|
* @param inputReadKey - Optional function to extract a key from each value. Defaults to identity.
|
|
146
148
|
* @returns A stateful filter function that returns true only for the first occurrence of each key.
|
|
149
|
+
* @__NO_SIDE_EFFECTS__
|
|
147
150
|
*/
|
|
148
151
|
export declare function allowValueOnceFilter<T extends PrimativeKey = PrimativeKey>(): AllowValueOnceFilter<T, T>;
|
|
149
152
|
export declare function allowValueOnceFilter<T, K extends PrimativeKey = PrimativeKey>(readKey?: ReadKeyFunction<T, K>): AllowValueOnceFilter<T, K>;
|
|
@@ -10,8 +10,15 @@ export type UniversalFilterMaybeArrayFunction = <T>(values: Maybe<Maybe<T>[]>) =
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a {@link FilterMaybeArrayFunction} that filters maybe values from an array using the provided filter function.
|
|
12
12
|
*
|
|
13
|
+
* @dbxUtil
|
|
14
|
+
* @dbxUtilCategory array
|
|
15
|
+
* @dbxUtilKind factory
|
|
16
|
+
* @dbxUtilTags array, filter, maybe, factory, predicate
|
|
17
|
+
* @dbxUtilRelated filter-maybe-array-values
|
|
18
|
+
*
|
|
13
19
|
* @param filterFn - Filter predicate used to determine which values to keep.
|
|
14
20
|
* @returns A function that filters maybe values from an optional input array.
|
|
21
|
+
* @__NO_SIDE_EFFECTS__
|
|
15
22
|
*/
|
|
16
23
|
export declare function filterMaybeArrayFunction<T>(filterFn: Parameters<Array<Maybe<T>>['filter']>[0]): FilterMaybeArrayFunction<T>;
|
|
17
24
|
/**
|
|
@@ -127,9 +127,16 @@ export declare const AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE: null;
|
|
|
127
127
|
* Each key in the config maps a claim key to role(s). Simple entries map a claim value to one or more roles,
|
|
128
128
|
* while encode/decode entries allow custom bidirectional conversion logic.
|
|
129
129
|
*
|
|
130
|
+
* @dbxUtil
|
|
131
|
+
* @dbxUtilCategory auth
|
|
132
|
+
* @dbxUtilKind factory
|
|
133
|
+
* @dbxUtilTags auth, role, claims, jwt, factory, bidirectional
|
|
134
|
+
* @dbxUtilRelated auth-role
|
|
135
|
+
*
|
|
130
136
|
* @param config - Mapping of claim keys to their role configuration entries (or null to ignore)
|
|
131
137
|
* @param defaults - Optional default values for claim presence and absence
|
|
132
138
|
* @returns A service with `toClaims` and `toRoles` conversion functions
|
|
139
|
+
* @__NO_SIDE_EFFECTS__
|
|
133
140
|
*/
|
|
134
141
|
export declare function authRoleClaimsService<T extends AuthClaimsObject>(config: AuthRoleClaimsFactoryConfig<T>, defaults?: AuthRoleClaimsFactoryDefaults): AuthRoleClaimsService<T>;
|
|
135
142
|
/**
|
package/src/lib/boolean.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ export interface BooleanFactoryConfig {
|
|
|
154
154
|
* const coinFlip = booleanFactory({ chance: 50 });
|
|
155
155
|
* coinFlip(); // true or false with equal probability
|
|
156
156
|
* ```
|
|
157
|
+
* @__NO_SIDE_EFFECTS__
|
|
157
158
|
*/
|
|
158
159
|
export declare function booleanFactory(config: BooleanFactoryConfig): BooleanFactory;
|
|
159
160
|
/**
|
|
@@ -29,8 +29,15 @@ export type RandomEmailFactory = Factory<EmailAddress>;
|
|
|
29
29
|
/**
|
|
30
30
|
* Creates a factory that generates random email addresses using configurable prefixes, domains, and number generators.
|
|
31
31
|
*
|
|
32
|
+
* @dbxUtil
|
|
33
|
+
* @dbxUtilCategory contact
|
|
34
|
+
* @dbxUtilKind factory
|
|
35
|
+
* @dbxUtilTags contact, email, random, factory, generate
|
|
36
|
+
* @dbxUtilRelated random-phone-number-factory, incrementing-number-factory
|
|
37
|
+
*
|
|
32
38
|
* @param inputConfig - Optional configuration overrides
|
|
33
39
|
* @returns A factory function that produces random email address strings
|
|
40
|
+
* @__NO_SIDE_EFFECTS__
|
|
34
41
|
*/
|
|
35
42
|
export declare function randomEmailFactory(inputConfig?: RandomEmailFactoryConfig): RandomEmailFactory;
|
|
36
43
|
/**
|
|
@@ -54,7 +61,14 @@ export type RandomPhoneNumberFactory = Factory<E164PhoneNumber>;
|
|
|
54
61
|
/**
|
|
55
62
|
* Creates a factory that generates random E.164 phone numbers using configurable area codes and number generators.
|
|
56
63
|
*
|
|
64
|
+
* @dbxUtil
|
|
65
|
+
* @dbxUtilCategory contact
|
|
66
|
+
* @dbxUtilKind factory
|
|
67
|
+
* @dbxUtilTags contact, phone, e164, random, factory, generate
|
|
68
|
+
* @dbxUtilRelated random-email-factory, random-number-factory
|
|
69
|
+
*
|
|
57
70
|
* @param inputConfig - Optional configuration overrides
|
|
58
71
|
* @returns A factory function that produces random E.164 phone number strings
|
|
72
|
+
* @__NO_SIDE_EFFECTS__
|
|
59
73
|
*/
|
|
60
74
|
export declare function randomPhoneNumberFactory(inputConfig?: RandomPhoneNumberFactoryConfig): RandomPhoneNumberFactory;
|