@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
|
@@ -23,17 +23,17 @@ export interface IndexSetPair<T> extends IndexRef {
|
|
|
23
23
|
/**
|
|
24
24
|
* Runs a filter on an array and returns an {@link IndexSet} containing the indices of values that match.
|
|
25
25
|
*
|
|
26
|
-
* @param input -
|
|
27
|
-
* @param filter -
|
|
28
|
-
* @returns
|
|
26
|
+
* @param input - Array to search through.
|
|
27
|
+
* @param filter - Predicate function to test each value.
|
|
28
|
+
* @returns An {@link IndexSet} of indices for matching values.
|
|
29
29
|
*/
|
|
30
30
|
export declare function findToIndexSet<T>(input: T[], filter: (value: T) => boolean): IndexSet;
|
|
31
31
|
/**
|
|
32
32
|
* Expands an {@link IndexSet} into an {@link IndexSetPairSet} by pairing each index with the corresponding item from the input array.
|
|
33
33
|
*
|
|
34
|
-
* @param input -
|
|
35
|
-
* @param indexSet -
|
|
36
|
-
* @returns
|
|
34
|
+
* @param input - Source array to retrieve items from.
|
|
35
|
+
* @param indexSet - Set of indices to expand.
|
|
36
|
+
* @returns An {@link IndexSetPairSet} pairing each index with its corresponding item.
|
|
37
37
|
*/
|
|
38
38
|
export declare function expandIndexSet<T>(input: T[], indexSet: IndexSet): IndexSetPairSet<T>;
|
|
39
39
|
/**
|
|
@@ -42,9 +42,9 @@ export declare function expandIndexSet<T>(input: T[], indexSet: IndexSet): Index
|
|
|
42
42
|
* The comparison follows ascending sort conventions: a negative return value from the compare function
|
|
43
43
|
* indicates the second argument is "better" than the first.
|
|
44
44
|
*
|
|
45
|
-
* @param input -
|
|
46
|
-
* @param compare -
|
|
47
|
-
* @returns
|
|
45
|
+
* @param input - Array of items to search through.
|
|
46
|
+
* @param compare - Comparison function used to determine the best item.
|
|
47
|
+
* @returns An {@link IndexSetPair} containing the best item and its index.
|
|
48
48
|
*/
|
|
49
49
|
export declare function findBest<T>(input: T[], compare: (a: T, b: T) => number): IndexSetPair<T>;
|
|
50
50
|
/**
|
|
@@ -52,9 +52,9 @@ export declare function findBest<T>(input: T[], compare: (a: T, b: T) => number)
|
|
|
52
52
|
*
|
|
53
53
|
* Pairs with null/undefined items are skipped in favor of pairs with defined items.
|
|
54
54
|
*
|
|
55
|
-
* @param input -
|
|
56
|
-
* @param compare -
|
|
57
|
-
* @returns
|
|
55
|
+
* @param input - Set of index-item pairs to search through.
|
|
56
|
+
* @param compare - Ascending sort comparison function used to determine the best item.
|
|
57
|
+
* @returns The {@link IndexSetPair} containing the best item.
|
|
58
58
|
*/
|
|
59
59
|
export declare function findBestIndexSetPair<T>(input: IndexSetPairSet<T>, compare: AscendingSortCompareFunction<T>): IndexSetPair<T>;
|
|
60
60
|
/**
|
|
@@ -67,14 +67,15 @@ 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
|
+
* @param inputRange - Range boundaries to bake into the returned slicer.
|
|
71
|
+
* @returns Reusable slicer that extracts the configured range from any input array.
|
|
72
|
+
*
|
|
70
73
|
* @dbxUtil
|
|
71
74
|
* @dbxUtilCategory array
|
|
72
75
|
* @dbxUtilKind factory
|
|
73
76
|
* @dbxUtilTags array, slice, index, range, factory
|
|
74
77
|
* @dbxUtilRelated index-range, find-to-index-set
|
|
75
78
|
*
|
|
76
|
-
* @param inputRange - the index range configuration to use for slicing
|
|
77
|
-
* @returns a function that slices the configured range from an input array
|
|
78
79
|
* @__NO_SIDE_EFFECTS__
|
|
79
80
|
*/
|
|
80
81
|
export declare function sliceIndexRangeFunction<T>(inputRange: IndexRangeInput): SliceIndexRangeFunction<T>;
|
|
@@ -4,18 +4,18 @@ import { type ArrayFindDecisionFunction } from './array.find';
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates an IndexRange for the input array, spanning from index 0 to the array's length.
|
|
6
6
|
*
|
|
7
|
-
* @param array -
|
|
8
|
-
* @returns
|
|
7
|
+
* @param array - Source whose length defines the maxIndex boundary.
|
|
8
|
+
* @returns Range pair spanning index 0 through the array's length.
|
|
9
9
|
*/
|
|
10
10
|
export declare function indexRangeForArray<T>(array: T[]): IndexRange;
|
|
11
11
|
/**
|
|
12
12
|
* Finds a value in the array using the provided decision function, then returns the value at the next index.
|
|
13
13
|
*
|
|
14
|
-
* @param array -
|
|
15
|
-
* @param find -
|
|
16
|
-
* @param wrapAround -
|
|
17
|
-
* @param steps -
|
|
18
|
-
* @returns
|
|
14
|
+
* @param array - Source to scan; nullish input short-circuits with undefined.
|
|
15
|
+
* @param find - Predicate that locates the anchor element to step from.
|
|
16
|
+
* @param wrapAround - When true, stepping past the end resumes from index 0.
|
|
17
|
+
* @param steps - Forward step count from the matched element; defaults to 1.
|
|
18
|
+
* @returns Element after the anchor, or undefined when the anchor or its step target falls outside the array.
|
|
19
19
|
*/
|
|
20
20
|
export declare function findNext<T>(array: Maybe<T[]>, find: ArrayFindDecisionFunction<T>, wrapAround?: boolean, steps?: number): Maybe<T>;
|
|
21
21
|
/**
|
|
@@ -26,11 +26,11 @@ export declare function findNext<T>(array: Maybe<T[]>, find: ArrayFindDecisionFu
|
|
|
26
26
|
* When wrapAround is true, indexes that are larger than the entire array will be used to find an index that is that many steps into the array.
|
|
27
27
|
* For instance, an index of 5 on an array of length 3 will return the index 1.
|
|
28
28
|
*
|
|
29
|
-
* @param array -
|
|
30
|
-
* @param index -
|
|
31
|
-
* @param wrapAround -
|
|
32
|
-
* @param steps -
|
|
33
|
-
* @returns
|
|
29
|
+
* @param array - Source whose bounds anchor the step computation.
|
|
30
|
+
* @param index - Current position from which to advance.
|
|
31
|
+
* @param wrapAround - When true, stepping past the end resumes from index 0.
|
|
32
|
+
* @param steps - Forward step count from the current index.
|
|
33
|
+
* @returns Stepped index when `index` is inside the array; otherwise undefined.
|
|
34
34
|
*/
|
|
35
35
|
export declare function getArrayNextIndex<T>(array: T[], index: number, wrapAround?: boolean, steps?: number): Maybe<number>;
|
|
36
36
|
/**
|
|
@@ -46,14 +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
|
+
* @param readIndexRange - Function that reads the index range from each value.
|
|
50
|
+
* @returns A factory that creates ranged accessors from arrays of values.
|
|
51
|
+
*
|
|
49
52
|
* @dbxUtil
|
|
50
53
|
* @dbxUtilCategory array
|
|
51
54
|
* @dbxUtilKind factory
|
|
52
55
|
* @dbxUtilTags array, indexed, range, accessor, factory, lookup
|
|
53
56
|
* @dbxUtilRelated indexed-values-array-accessor-factory, ranged-indexed-values-array-accessor-info-factory
|
|
54
57
|
*
|
|
55
|
-
* @param readIndexRange - Function that reads the index range from each value.
|
|
56
|
-
* @returns A factory that creates ranged accessors from arrays of values.
|
|
57
58
|
* @__NO_SIDE_EFFECTS__
|
|
58
59
|
*/
|
|
59
60
|
export declare function rangedIndexedValuesArrayAccessorFactory<T>(readIndexRange: ReadIndexRangeFunction<T>): RangedIndexedValuesArrayAccessorFactory<T>;
|
|
@@ -71,15 +72,16 @@ export type IndexedValuesArrayAccessorFactory<T> = (values: T[]) => IndexedValue
|
|
|
71
72
|
* Each accessor maps an index to the matching value, falling back to the previous value, then the next value.
|
|
72
73
|
* This guarantees a value is always returned.
|
|
73
74
|
*
|
|
75
|
+
* @param readIndexRange - Function that reads the index range from each value.
|
|
76
|
+
* @returns A factory that creates indexed accessors from arrays of values.
|
|
77
|
+
* @throws {Error} If the provided values array is empty.
|
|
78
|
+
*
|
|
74
79
|
* @dbxUtil
|
|
75
80
|
* @dbxUtilCategory array
|
|
76
81
|
* @dbxUtilKind factory
|
|
77
82
|
* @dbxUtilTags array, indexed, range, accessor, factory, fallback
|
|
78
83
|
* @dbxUtilRelated ranged-indexed-values-array-accessor-factory, ranged-indexed-values-array-accessor-info-factory
|
|
79
84
|
*
|
|
80
|
-
* @param readIndexRange - Function that reads the index range from each value.
|
|
81
|
-
* @returns A factory that creates indexed accessors from arrays of values.
|
|
82
|
-
* @throws Error if the provided values array is empty.
|
|
83
85
|
* @__NO_SIDE_EFFECTS__
|
|
84
86
|
*/
|
|
85
87
|
export declare function indexedValuesArrayAccessorFactory<T>(readIndexRange: ReadIndexRangeFunction<T>): IndexedValuesArrayAccessorFactory<T>;
|
|
@@ -123,14 +125,15 @@ export interface RangedIndexedValuesArrayInfoAccessorFactoryConfig<T> {
|
|
|
123
125
|
* Each accessor sorts the values by their index ranges in ascending order, then for a given index
|
|
124
126
|
* returns the matching value along with its previous and next neighbors.
|
|
125
127
|
*
|
|
128
|
+
* @param config - Configuration containing the index range reader function.
|
|
129
|
+
* @returns A factory that creates ranged info accessors from arrays of values.
|
|
130
|
+
*
|
|
126
131
|
* @dbxUtil
|
|
127
132
|
* @dbxUtilCategory array
|
|
128
133
|
* @dbxUtilKind factory
|
|
129
134
|
* @dbxUtilTags array, indexed, range, accessor, info, factory, neighbors
|
|
130
135
|
* @dbxUtilRelated ranged-indexed-values-array-accessor-factory, indexed-values-array-accessor-factory
|
|
131
136
|
*
|
|
132
|
-
* @param config - Configuration containing the index range reader function.
|
|
133
|
-
* @returns A factory that creates ranged info accessors from arrays of values.
|
|
134
137
|
* @__NO_SIDE_EFFECTS__
|
|
135
138
|
*/
|
|
136
139
|
export declare function rangedIndexedValuesArrayAccessorInfoFactory<T>(config: RangedIndexedValuesArrayInfoAccessorFactoryConfig<T>): RangedIndexedValuesArrayInfoAccessorFactory<T>;
|
|
@@ -23,14 +23,15 @@ 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
|
+
* @param config - Configuration containing the make function and random number source.
|
|
27
|
+
* @returns A factory that produces arrays of random length, optionally accepting a specific count override.
|
|
28
|
+
*
|
|
26
29
|
* @dbxUtil
|
|
27
30
|
* @dbxUtilCategory array
|
|
28
31
|
* @dbxUtilKind factory
|
|
29
32
|
* @dbxUtilTags array, random, factory, generate, make
|
|
30
33
|
* @dbxUtilRelated array-factory, random-number-factory
|
|
31
34
|
*
|
|
32
|
-
* @param config - configuration containing the make function and random number source
|
|
33
|
-
* @returns a factory that produces arrays of random length, optionally accepting a specific count override
|
|
34
35
|
* @__NO_SIDE_EFFECTS__
|
|
35
36
|
*/
|
|
36
37
|
export declare function randomArrayFactory<T>(config: RandomArrayFactoryConfig<T>): RandomArrayFactory<T>;
|
|
@@ -27,10 +27,10 @@ export declare function arrayToObject<T, K extends PrimativeKey = PrimativeKey>(
|
|
|
27
27
|
/**
|
|
28
28
|
* Returns values for each key, reusing existing items when available and generating new ones for missing keys.
|
|
29
29
|
*
|
|
30
|
-
* @param keys -
|
|
31
|
-
* @param existing -
|
|
32
|
-
* @param readKey -
|
|
33
|
-
* @param generateFn -
|
|
34
|
-
* @returns
|
|
30
|
+
* @param keys - The keys to resolve values for.
|
|
31
|
+
* @param existing - Array of pre-existing items to check against.
|
|
32
|
+
* @param readKey - Function to extract a key from an existing item.
|
|
33
|
+
* @param generateFn - Function to create a new item for a key not found in existing items.
|
|
34
|
+
* @returns Items aligned to `keys` — reused when present in `existing`, generated otherwise.
|
|
35
35
|
*/
|
|
36
36
|
export declare function generateIfDoesNotExist<T, K extends PrimativeKey = PrimativeKey>(keys: K[], existing: T[], readKey: ReadKeyFunction<T, K>, generateFn: (key: K) => T): T[];
|
|
@@ -3,55 +3,55 @@ import { type IndexRange } from '../value/indexed';
|
|
|
3
3
|
/**
|
|
4
4
|
* Reduces an array of numbers to its maximum value.
|
|
5
5
|
*
|
|
6
|
-
* @param array -
|
|
7
|
-
* @param emptyArrayValue -
|
|
8
|
-
* @returns
|
|
6
|
+
* @param array - Numbers to evaluate.
|
|
7
|
+
* @param emptyArrayValue - Value to return when the array is empty.
|
|
8
|
+
* @returns The maximum number in the array, or the empty array value if the array is empty.
|
|
9
9
|
*/
|
|
10
|
-
export declare function reduceNumbersWithMax(array: number[], emptyArrayValue?: number): number
|
|
10
|
+
export declare function reduceNumbersWithMax(array: number[], emptyArrayValue?: number): Maybe<number>;
|
|
11
11
|
/**
|
|
12
12
|
* Creates a reducer function that finds the maximum value in a number array.
|
|
13
13
|
*
|
|
14
|
-
* @param emptyArrayValue -
|
|
15
|
-
* @returns
|
|
14
|
+
* @param emptyArrayValue - Value to return when the array is empty.
|
|
15
|
+
* @returns Reducer that, given a number array, yields its maximum value (or the empty-array fallback).
|
|
16
16
|
*/
|
|
17
|
-
export declare function reduceNumbersWithMaxFn(emptyArrayValue?: number): (array: number[]) => number
|
|
17
|
+
export declare function reduceNumbersWithMaxFn(emptyArrayValue?: number): (array: number[]) => Maybe<number>;
|
|
18
18
|
/**
|
|
19
19
|
* Reduces an array of numbers to its minimum value.
|
|
20
20
|
*
|
|
21
|
-
* @param array -
|
|
22
|
-
* @param emptyArrayValue -
|
|
23
|
-
* @returns
|
|
21
|
+
* @param array - Numbers to evaluate.
|
|
22
|
+
* @param emptyArrayValue - Value to return when the array is empty.
|
|
23
|
+
* @returns The minimum number in the array, or the empty array value if the array is empty.
|
|
24
24
|
*/
|
|
25
|
-
export declare function reduceNumbersWithMin(array: number[], emptyArrayValue?: number): number
|
|
25
|
+
export declare function reduceNumbersWithMin(array: number[], emptyArrayValue?: number): Maybe<number>;
|
|
26
26
|
/**
|
|
27
27
|
* Creates a reducer function that finds the minimum value in a number array.
|
|
28
28
|
*
|
|
29
|
-
* @param emptyArrayValue -
|
|
30
|
-
* @returns
|
|
29
|
+
* @param emptyArrayValue - Value to return when the array is empty.
|
|
30
|
+
* @returns Reducer that, given a number array, yields its minimum value (or the empty-array fallback).
|
|
31
31
|
*/
|
|
32
|
-
export declare function reduceNumbersWithMinFn(emptyArrayValue?: number): (array: number[]) => number
|
|
32
|
+
export declare function reduceNumbersWithMinFn(emptyArrayValue?: number): (array: number[]) => Maybe<number>;
|
|
33
33
|
/**
|
|
34
34
|
* Reduces an array of numbers by summing all values.
|
|
35
35
|
*
|
|
36
|
-
* @param array -
|
|
37
|
-
* @param emptyArrayValue -
|
|
38
|
-
* @returns
|
|
36
|
+
* @param array - Numbers to sum.
|
|
37
|
+
* @param emptyArrayValue - Value to return when the array is empty; defaults to 0.
|
|
38
|
+
* @returns The sum of all numbers in the array.
|
|
39
39
|
*/
|
|
40
40
|
export declare function reduceNumbersWithAdd(array: number[], emptyArrayValue?: number): number;
|
|
41
41
|
/**
|
|
42
42
|
* Creates a reducer function that sums all values in a number array.
|
|
43
43
|
*
|
|
44
|
-
* @param emptyArrayValue -
|
|
45
|
-
* @returns
|
|
44
|
+
* @param emptyArrayValue - Value to return when the array is empty; defaults to 0.
|
|
45
|
+
* @returns Reducer that, given a number array, yields the running sum across all entries.
|
|
46
46
|
*/
|
|
47
47
|
export declare function reduceNumbersWithAddFn(emptyArrayValue?: number): (array: number[]) => number;
|
|
48
48
|
/**
|
|
49
49
|
* Reduces an array of numbers using a custom reducer function.
|
|
50
50
|
*
|
|
51
|
-
* @param reduceFn -
|
|
52
|
-
* @param array -
|
|
53
|
-
* @param emptyArrayValue -
|
|
54
|
-
* @returns
|
|
51
|
+
* @param reduceFn - Binary function applied to successive pairs of numbers.
|
|
52
|
+
* @param array - Numbers to reduce.
|
|
53
|
+
* @param emptyArrayValue - Value to return when the array is empty.
|
|
54
|
+
* @returns The reduced result, or the empty array value if the array is empty.
|
|
55
55
|
*/
|
|
56
56
|
export declare function reduceNumbers(reduceFn: (a: number, b: number) => number, array: number[], emptyArrayValue?: number): Maybe<number>;
|
|
57
57
|
/**
|
|
@@ -61,7 +61,7 @@ export declare function reduceNumbers(reduceFn: (a: number, b: number) => number
|
|
|
61
61
|
* @param emptyArrayValue - value to return when the array is empty
|
|
62
62
|
* @returns a function that reduces a number array to a single value
|
|
63
63
|
*/
|
|
64
|
-
export declare function reduceNumbersFn(reduceFn: (a: number, b: number) => number): (array: number[]) => number
|
|
64
|
+
export declare function reduceNumbersFn(reduceFn: (a: number, b: number) => number): (array: number[]) => Maybe<number>;
|
|
65
65
|
export declare function reduceNumbersFn<D extends number>(reduceFn: (a: number, b: number) => number, emptyArrayValue?: D): (array: number[]) => number | D;
|
|
66
66
|
/**
|
|
67
67
|
* Exclusive end value used by range().
|
|
@@ -92,8 +92,8 @@ export type RangeInput = number | RangeInputObject | IndexRange;
|
|
|
92
92
|
* Generates an array containing the range of numbers specified. The end value is excluded.
|
|
93
93
|
* Supports ascending and descending ranges.
|
|
94
94
|
*
|
|
95
|
-
* @param input -
|
|
96
|
-
* @param inputEnd -
|
|
97
|
-
* @returns
|
|
95
|
+
* @param input - Range specification as a number, {@link RangeInputObject}, or {@link IndexRange}; when a number and `inputEnd` is provided, acts as the start value.
|
|
96
|
+
* @param inputEnd - Optional exclusive end value when `input` is a number.
|
|
97
|
+
* @returns Sequential numbers covering the requested span, ordered ascending or descending as the bounds imply.
|
|
98
98
|
*/
|
|
99
99
|
export declare function range(input: RangeInput, inputEnd?: RangeInputEndValue): number[];
|
|
@@ -11,40 +11,41 @@ export type RandomPickFactory<T> = (() => T) & {
|
|
|
11
11
|
/**
|
|
12
12
|
* Creates a {@link RandomPickFactory} from the input values.
|
|
13
13
|
*
|
|
14
|
+
* @param values - Array of values to randomly pick from.
|
|
15
|
+
* @returns A callable factory that returns a random value from the array on each invocation.
|
|
16
|
+
* @throws {Error} If the input array is empty.
|
|
17
|
+
*
|
|
14
18
|
* @dbxUtil
|
|
15
19
|
* @dbxUtilCategory array
|
|
16
20
|
* @dbxUtilKind factory
|
|
17
21
|
* @dbxUtilTags array, random, pick, sample, choose, factory
|
|
18
22
|
* @dbxUtilRelated pick-one-randomly, random-array-index
|
|
19
23
|
*
|
|
20
|
-
* @param values - array of values to randomly pick from
|
|
21
|
-
* @returns a callable factory that returns a random value from the array on each invocation
|
|
22
|
-
* @throws Error if the input array is empty
|
|
23
24
|
* @__NO_SIDE_EFFECTS__
|
|
24
25
|
*/
|
|
25
26
|
export declare function randomPickFactory<T>(values: T[]): RandomPickFactory<T>;
|
|
26
27
|
/**
|
|
27
28
|
* Returns a random index from the input array. Returns 0 if the array is empty.
|
|
28
29
|
*
|
|
30
|
+
* @param values - Array to generate a random index for.
|
|
31
|
+
* @returns A random valid index within the array, or 0 if the array is empty.
|
|
32
|
+
*
|
|
29
33
|
* @dbxUtil
|
|
30
34
|
* @dbxUtilCategory array
|
|
31
35
|
* @dbxUtilTags array, random, index, position
|
|
32
36
|
* @dbxUtilRelated pick-one-randomly, random-pick-factory
|
|
33
|
-
*
|
|
34
|
-
* @param values - array to generate a random index for
|
|
35
|
-
* @returns a random valid index within the array, or 0 if the array is empty
|
|
36
37
|
*/
|
|
37
38
|
export declare function randomArrayIndex<T>(values: T[]): IndexNumber;
|
|
38
39
|
/**
|
|
39
40
|
* Picks a single item randomly from the input array.
|
|
40
41
|
*
|
|
42
|
+
* @param values - Array to pick a random item from.
|
|
43
|
+
* @returns A randomly selected item from the array.
|
|
44
|
+
* @throws {Error} If the input array is empty.
|
|
45
|
+
*
|
|
41
46
|
* @dbxUtil
|
|
42
47
|
* @dbxUtilCategory array
|
|
43
48
|
* @dbxUtilTags array, random, pick, sample, choose
|
|
44
49
|
* @dbxUtilRelated random-pick-factory, random-array-index
|
|
45
|
-
*
|
|
46
|
-
* @param values - array to pick a random item from
|
|
47
|
-
* @returns a randomly selected item from the array
|
|
48
|
-
* @throws Error if the input array is empty
|
|
49
50
|
*/
|
|
50
51
|
export declare function pickOneRandomly<T>(values: T[]): T;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns items that exist in both arrays (intersection).
|
|
3
3
|
*
|
|
4
|
+
* @param values - Source whose entries are kept only when present in the second array.
|
|
5
|
+
* @param secondArray - Allowed-values gate used for the intersection check.
|
|
6
|
+
* @returns Intersection of `values` and `secondArray`, ordered like `values`.
|
|
7
|
+
*
|
|
4
8
|
* @dbxUtil
|
|
5
9
|
* @dbxUtilCategory array
|
|
6
10
|
* @dbxUtilTags array, set, intersection, intersect, keep, common, both
|
|
7
11
|
* @dbxUtilRelated exclude-values-from-array
|
|
8
|
-
*
|
|
9
|
-
* @param values - The source array to filter.
|
|
10
|
-
* @param secondArray - The array of values to keep.
|
|
11
|
-
* @returns A new array containing only the values from `values` that also exist in `secondArray`.
|
|
12
12
|
*/
|
|
13
13
|
export declare function keepValuesFromArray<T>(values: T[], secondArray: T[]): T[];
|
|
14
14
|
/**
|
|
15
15
|
* Returns items from the first array that do not exist in the second array (difference).
|
|
16
16
|
*
|
|
17
|
+
* @param values - Source whose entries are kept only when absent from the second array.
|
|
18
|
+
* @param secondArray - Excluded-values gate used for the difference check.
|
|
19
|
+
* @returns Set difference `values \ secondArray`, ordered like `values`.
|
|
20
|
+
*
|
|
17
21
|
* @dbxUtil
|
|
18
22
|
* @dbxUtilCategory array
|
|
19
23
|
* @dbxUtilTags array, set, difference, exclude, subtract, diff
|
|
20
24
|
* @dbxUtilRelated keep-values-from-array
|
|
21
|
-
*
|
|
22
|
-
* @param values - The source array to filter.
|
|
23
|
-
* @param secondArray - The array of values to exclude.
|
|
24
|
-
* @returns A new array containing only the values from `values` that do not exist in `secondArray`.
|
|
25
25
|
*/
|
|
26
26
|
export declare function excludeValuesFromArray<T>(values: T[], secondArray: T[]): T[];
|
|
27
27
|
/**
|
|
28
28
|
* Checks whether the given array contains any duplicate values.
|
|
29
29
|
*
|
|
30
|
+
* @param values - Source to scan for any repeated entry.
|
|
31
|
+
* @returns True when at least one value appears more than once; otherwise false.
|
|
32
|
+
*
|
|
30
33
|
* @dbxUtil
|
|
31
34
|
* @dbxUtilCategory array
|
|
32
35
|
* @dbxUtilTags array, duplicate, check, validation, set
|
|
33
36
|
* @dbxUtilRelated find-index-of-first-duplicate-value, unique
|
|
34
|
-
*
|
|
35
|
-
* @param values - The array to check for duplicates.
|
|
36
|
-
* @returns `true` if the array contains at least one duplicate value, `false` otherwise.
|
|
37
37
|
*/
|
|
38
38
|
export declare function arrayContainsDuplicateValue<T>(values: T[]): boolean;
|
|
39
39
|
/**
|
|
40
40
|
* Finds the index of the first duplicate value in the given array.
|
|
41
41
|
*
|
|
42
|
+
* @param values - Source to scan left-to-right for the first repeat.
|
|
43
|
+
* @returns Index of the first value that matches an earlier one, or `-1` when all values are unique.
|
|
44
|
+
*
|
|
42
45
|
* @dbxUtil
|
|
43
46
|
* @dbxUtilCategory array
|
|
44
47
|
* @dbxUtilTags array, duplicate, find, index, search
|
|
45
48
|
* @dbxUtilRelated array-contains-duplicate-value, unique
|
|
46
|
-
*
|
|
47
|
-
* @param values - The array to search for duplicates.
|
|
48
|
-
* @returns The index of the first value that is a duplicate of an earlier value, or `-1` if no duplicates exist.
|
|
49
49
|
*/
|
|
50
50
|
export declare function findIndexOfFirstDuplicateValue<T>(values: T[]): number;
|
|
@@ -5,9 +5,9 @@ import { type TransformStringFunctionConfig } from '../string/transform';
|
|
|
5
5
|
/**
|
|
6
6
|
* Compares two string arrays and returns whether they contain different values, ignoring case.
|
|
7
7
|
*
|
|
8
|
-
* @param a -
|
|
9
|
-
* @param b -
|
|
10
|
-
* @returns `true` if the arrays contain different values when compared case-insensitively
|
|
8
|
+
* @param a - First array of strings to compare.
|
|
9
|
+
* @param b - Second array of strings to compare.
|
|
10
|
+
* @returns `true` if the arrays contain different values when compared case-insensitively.
|
|
11
11
|
*/
|
|
12
12
|
export declare function hasDifferentStringsNoCase(a: string[], b: string[]): boolean;
|
|
13
13
|
/**
|
|
@@ -39,74 +39,74 @@ export type TransformStringsFunction = MapFunction<string[], string[]>;
|
|
|
39
39
|
* Creates a {@link TransformStringsFunction} from the given configuration. If the configuration results
|
|
40
40
|
* in an identity transform, the returned function will be an identity function.
|
|
41
41
|
*
|
|
42
|
-
* @param config -
|
|
43
|
-
* @returns
|
|
42
|
+
* @param config - Configuration describing the string transformations to apply.
|
|
43
|
+
* @returns Operator that runs the configured per-string transform across every element, returning an identity transform when no rewriting is needed.
|
|
44
44
|
*/
|
|
45
45
|
export declare function transformStrings(config: TransformStringFunctionConfig): TransformStringsFunction;
|
|
46
46
|
/**
|
|
47
47
|
* Converts an iterable of strings to a lowercase string array for case-insensitive operations.
|
|
48
48
|
*
|
|
49
|
-
* @param values -
|
|
50
|
-
* @returns
|
|
49
|
+
* @param values - Iterable of strings to convert.
|
|
50
|
+
* @returns Lower-cased materialization suitable for case-insensitive comparisons.
|
|
51
51
|
*/
|
|
52
52
|
export declare function toCaseInsensitiveStringArray(values: Iterable<string>): string[];
|
|
53
53
|
/**
|
|
54
54
|
* Returns an array of unique strings from the input, compared case-insensitively. All returned strings are lowercase.
|
|
55
55
|
*
|
|
56
|
-
* @param values -
|
|
57
|
-
* @returns
|
|
56
|
+
* @param values - Iterable of strings to deduplicate.
|
|
57
|
+
* @returns Deduped lower-cased values preserving first-seen order.
|
|
58
58
|
*/
|
|
59
59
|
export declare function uniqueCaseInsensitiveStrings(values: Iterable<string>): string[];
|
|
60
60
|
/**
|
|
61
61
|
* Returns a {@link Set} of unique lowercase strings from the input, compared case-insensitively.
|
|
62
62
|
*
|
|
63
|
-
* @param values -
|
|
64
|
-
* @returns
|
|
63
|
+
* @param values - Iterable of strings to deduplicate.
|
|
64
|
+
* @returns Membership-only collection of the deduped lower-cased values.
|
|
65
65
|
*/
|
|
66
66
|
export declare function uniqueCaseInsensitiveStringsSet(values: Iterable<string>): Set<string>;
|
|
67
67
|
/**
|
|
68
68
|
* Flattens a two-dimensional array of strings into a single array of unique lowercase strings, compared case-insensitively.
|
|
69
69
|
*
|
|
70
|
-
* @param array -
|
|
71
|
-
* @returns
|
|
70
|
+
* @param array - Two-dimensional array of strings to flatten and deduplicate.
|
|
71
|
+
* @returns Single-dimension deduped lower-cased values drawn from every nested row.
|
|
72
72
|
*/
|
|
73
73
|
export declare function flattenArrayUniqueCaseInsensitiveStrings(array: string[][]): string[];
|
|
74
74
|
/**
|
|
75
75
|
* Filters an array of models to only include items with unique keys when compared case-insensitively.
|
|
76
76
|
* Items whose keys match the additional keys are also excluded.
|
|
77
77
|
*
|
|
78
|
-
* @param models -
|
|
79
|
-
* @param readKey -
|
|
80
|
-
* @param additionalKeys -
|
|
81
|
-
* @returns
|
|
78
|
+
* @param models - Array of models to filter.
|
|
79
|
+
* @param readKey - Function that extracts the string key from each model.
|
|
80
|
+
* @param additionalKeys - Optional keys to treat as already seen, excluding models with matching keys.
|
|
81
|
+
* @returns The filtered array of models with unique case-insensitive keys.
|
|
82
82
|
*/
|
|
83
83
|
export declare function filterUniqueCaseInsensitiveStrings<T, K extends string = string>(models: T[], readKey: ReadKeyFunction<T, K>, additionalKeys?: K[]): T[];
|
|
84
84
|
/**
|
|
85
85
|
* Checks whether the given iterable contains the specified string, ignoring case.
|
|
86
86
|
*
|
|
87
|
-
* @param values -
|
|
88
|
-
* @param valueToFind -
|
|
89
|
-
* @param mustContainAtleastOneItem -
|
|
90
|
-
* @returns `true` if the string is found case-insensitively
|
|
87
|
+
* @param values - Iterable of strings to search.
|
|
88
|
+
* @param valueToFind - Value to search for, compared case-insensitively.
|
|
89
|
+
* @param mustContainAtleastOneItem - If `true`, returns `false` when the values iterable is empty.
|
|
90
|
+
* @returns `true` if the string is found case-insensitively.
|
|
91
91
|
*/
|
|
92
92
|
export declare function containsStringAnyCase(values: Iterable<string>, valueToFind: string, mustContainAtleastOneItem?: boolean): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Checks whether the given iterable contains any of the specified strings, ignoring case.
|
|
95
95
|
*
|
|
96
|
-
* @param values -
|
|
97
|
-
* @param valuesToFind -
|
|
98
|
-
* @param mustContainAtleastOneItem -
|
|
99
|
-
* @returns `true` if at least one of the strings is found case-insensitively
|
|
96
|
+
* @param values - Iterable of strings to search.
|
|
97
|
+
* @param valuesToFind - Iterable of strings to search for.
|
|
98
|
+
* @param mustContainAtleastOneItem - If `true`, returns `false` when the values iterable is empty.
|
|
99
|
+
* @returns `true` if at least one of the strings is found case-insensitively.
|
|
100
100
|
*/
|
|
101
101
|
export declare function containsAnyStringAnyCase(values: Iterable<string>, valuesToFind: Iterable<string>, mustContainAtleastOneItem?: boolean): boolean;
|
|
102
102
|
/**
|
|
103
103
|
* Checks whether the given iterable contains all of the specified strings, ignoring case.
|
|
104
104
|
* Returns `true` if there are no strings to find.
|
|
105
105
|
*
|
|
106
|
-
* @param values -
|
|
107
|
-
* @param valuesToFind -
|
|
108
|
-
* @param mustContainAtleastOneItem -
|
|
109
|
-
* @returns `true` if all of the strings are found case-insensitively
|
|
106
|
+
* @param values - Iterable of strings to search.
|
|
107
|
+
* @param valuesToFind - Iterable of strings that must all be present.
|
|
108
|
+
* @param mustContainAtleastOneItem - If `true`, returns `false` when the values iterable is empty.
|
|
109
|
+
* @returns `true` if all of the strings are found case-insensitively.
|
|
110
110
|
*/
|
|
111
111
|
export declare function containsAllStringsAnyCase(values: Iterable<string>, valuesToFind: Iterable<string>, mustContainAtleastOneItem?: boolean): boolean;
|
|
112
112
|
/**
|
|
@@ -133,7 +133,7 @@ export type FilterUniqueTransform = TransformStringsFunction;
|
|
|
133
133
|
* When `caseInsensitive` is enabled, uniqueness is determined before transformation; otherwise, transformation
|
|
134
134
|
* is applied first and then duplicates are removed.
|
|
135
135
|
*
|
|
136
|
-
* @param config -
|
|
137
|
-
* @returns
|
|
136
|
+
* @param config - Configuration describing transformation, uniqueness comparison, and exclusions.
|
|
137
|
+
* @returns Operator that transforms then dedupes an input array per the supplied configuration.
|
|
138
138
|
*/
|
|
139
139
|
export declare function filterUniqueTransform(config: FilterUniqueStringsTransformConfig): FilterUniqueTransform;
|