@dereekb/util 13.11.1 → 13.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint/index.cjs.default.js +1 -0
- package/eslint/index.cjs.js +607 -0
- package/eslint/index.cjs.mjs +2 -0
- package/eslint/index.d.ts +1 -0
- package/eslint/index.esm.js +603 -0
- package/eslint/package.json +23 -0
- package/eslint/src/index.d.ts +1 -0
- package/eslint/src/lib/comments.d.ts +54 -0
- package/eslint/src/lib/index.d.ts +3 -0
- package/eslint/src/lib/plugin.d.ts +18 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +42 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +54 -0
- package/fetch/package.json +2 -2
- package/index.cjs.js +1203 -23
- package/index.esm.js +1203 -23
- package/package.json +7 -1
- package/src/lib/array/array.factory.d.ts +2 -0
- package/src/lib/array/array.filter.d.ts +50 -17
- package/src/lib/array/array.find.d.ts +1 -0
- package/src/lib/array/array.index.d.ts +7 -0
- package/src/lib/array/array.indexed.d.ts +21 -0
- package/src/lib/array/array.make.d.ts +7 -0
- package/src/lib/array/array.random.d.ts +1 -0
- package/src/lib/array/array.unique.d.ts +3 -0
- package/src/lib/array/array.value.d.ts +7 -0
- package/src/lib/auth/auth.role.claims.d.ts +7 -0
- package/src/lib/boolean.d.ts +1 -0
- package/src/lib/contact/random.d.ts +14 -0
- package/src/lib/date/date.d.ts +6 -0
- package/src/lib/date/time.d.ts +7 -0
- package/src/lib/date/week.d.ts +7 -0
- package/src/lib/error/error.d.ts +7 -0
- package/src/lib/filter/filter.d.ts +7 -0
- package/src/lib/function/function.boolean.d.ts +7 -0
- package/src/lib/function/function.forward.d.ts +14 -0
- package/src/lib/getter/getter.cache.d.ts +7 -0
- package/src/lib/getter/getter.d.ts +34 -0
- package/src/lib/getter/getter.map.d.ts +7 -0
- package/src/lib/getter/getter.util.d.ts +7 -0
- package/src/lib/grouping.d.ts +8 -0
- package/src/lib/hash.d.ts +1 -0
- package/src/lib/key.d.ts +16 -0
- package/src/lib/map/map.key.d.ts +14 -0
- package/src/lib/model/id.batch.d.ts +7 -0
- package/src/lib/model/id.factory.d.ts +7 -0
- package/src/lib/model/model.conversion.d.ts +35 -0
- package/src/lib/model/model.copy.d.ts +7 -0
- package/src/lib/model/model.d.ts +19 -0
- package/src/lib/model/model.modify.d.ts +14 -0
- package/src/lib/nodejs/stream.d.ts +7 -0
- package/src/lib/number/bound.d.ts +3 -0
- package/src/lib/number/dollar.d.ts +7 -0
- package/src/lib/number/factory.d.ts +7 -0
- package/src/lib/number/random.d.ts +1 -0
- package/src/lib/number/round.d.ts +22 -0
- package/src/lib/number/sort.d.ts +7 -0
- package/src/lib/number/transform.d.ts +7 -0
- package/src/lib/object/object.array.delta.d.ts +7 -0
- package/src/lib/object/object.equal.d.ts +7 -0
- package/src/lib/object/object.filter.pojo.d.ts +87 -0
- package/src/lib/object/object.filter.tuple.d.ts +16 -0
- package/src/lib/object/object.key.d.ts +14 -0
- package/src/lib/object/object.map.d.ts +14 -0
- package/src/lib/path/path.d.ts +9 -0
- package/src/lib/promise/promise.d.ts +21 -0
- package/src/lib/promise/promise.factory.d.ts +7 -0
- package/src/lib/promise/promise.task.d.ts +7 -0
- package/src/lib/service/handler.config.d.ts +28 -0
- package/src/lib/service/handler.d.ts +14 -0
- package/src/lib/set/set.d.ts +21 -0
- package/src/lib/set/set.decision.d.ts +7 -0
- package/src/lib/set/set.delta.d.ts +7 -0
- package/src/lib/set/set.selection.d.ts +7 -0
- package/src/lib/sort.d.ts +8 -0
- package/src/lib/string/char.d.ts +7 -0
- package/src/lib/string/dencoder.d.ts +35 -0
- package/src/lib/string/factory.d.ts +22 -1
- package/src/lib/string/replace.d.ts +78 -0
- package/src/lib/string/search.d.ts +7 -0
- package/src/lib/string/sort.d.ts +7 -0
- package/src/lib/string/string.d.ts +1 -0
- package/src/lib/string/transform.d.ts +53 -0
- package/src/lib/string/tree.d.ts +7 -0
- package/src/lib/string/url.d.ts +7 -0
- package/src/lib/tree/tree.array.d.ts +1 -0
- package/src/lib/tree/tree.explore.d.ts +3 -0
- package/src/lib/type.d.ts +3 -2
- package/src/lib/value/bound.d.ts +28 -0
- package/src/lib/value/comparator.d.ts +16 -0
- package/src/lib/value/decision.d.ts +5 -0
- package/src/lib/value/equal.d.ts +2 -0
- package/src/lib/value/indexed.d.ts +127 -0
- package/src/lib/value/map.d.ts +22 -0
- package/src/lib/value/maybe.type.d.ts +2 -2
- package/src/lib/value/modifier.d.ts +13 -0
- package/src/lib/value/point.d.ts +56 -0
- package/src/lib/value/use.d.ts +37 -0
- package/src/lib/value/vector.d.ts +7 -0
- package/test/index.cjs.js +17 -4
- package/test/index.esm.js +17 -4
- package/test/package.json +2 -2
- package/test/src/lib/shared/shared.fail.d.ts +24 -5
|
@@ -21,8 +21,15 @@ export interface ReplaceStringsConfig {
|
|
|
21
21
|
/**
|
|
22
22
|
* Creates a function that replaces all occurrences of the configured target strings with a replacement value.
|
|
23
23
|
*
|
|
24
|
+
* @dbxUtil
|
|
25
|
+
* @dbxUtilCategory string
|
|
26
|
+
* @dbxUtilKind factory
|
|
27
|
+
* @dbxUtilTags string, replace, regex, substitute, factory
|
|
28
|
+
* @dbxUtilRelated find-strings-regex-string, escape-string-for-regex
|
|
29
|
+
*
|
|
24
30
|
* @param config - Configuration specifying strings to find and the replacement value.
|
|
25
31
|
* @returns A function that performs the configured replacements on an input string.
|
|
32
|
+
* @__NO_SIDE_EFFECTS__
|
|
26
33
|
*/
|
|
27
34
|
export declare function replaceStringsFunction(config: ReplaceStringsConfig): (input: string) => string;
|
|
28
35
|
/**
|
|
@@ -36,6 +43,11 @@ export declare const REGEX_SPECIAL_CHARACTERS_SET: Set<string>;
|
|
|
36
43
|
/**
|
|
37
44
|
* Creates an escaped regex string that matches any of the input values, joined with the OR (`|`) operator.
|
|
38
45
|
*
|
|
46
|
+
* @dbxUtil
|
|
47
|
+
* @dbxUtilCategory string
|
|
48
|
+
* @dbxUtilTags string, regex, escape, alternation, pattern
|
|
49
|
+
* @dbxUtilRelated escape-string-for-regex, replace-strings-function
|
|
50
|
+
*
|
|
39
51
|
* @param find - One or more strings to create a matching regex pattern for.
|
|
40
52
|
* @returns A regex-compatible string with special characters escaped and values joined by `|`.
|
|
41
53
|
*/
|
|
@@ -67,8 +79,15 @@ export type EscapeStringCharactersFunction = (input: string) => string;
|
|
|
67
79
|
/**
|
|
68
80
|
* Creates an {@link EscapeStringCharactersFunction} that escapes specific characters in a string using the configured escape strategy.
|
|
69
81
|
*
|
|
82
|
+
* @dbxUtil
|
|
83
|
+
* @dbxUtilCategory string
|
|
84
|
+
* @dbxUtilKind factory
|
|
85
|
+
* @dbxUtilTags string, escape, characters, factory, transform
|
|
86
|
+
* @dbxUtilRelated escape-string-for-regex, find-all-character-occurences-function
|
|
87
|
+
*
|
|
70
88
|
* @param config - Configuration specifying which characters to escape and how to escape them.
|
|
71
89
|
* @returns A function that escapes the configured characters in any input string.
|
|
90
|
+
* @__NO_SIDE_EFFECTS__
|
|
72
91
|
*/
|
|
73
92
|
export declare function escapeStringCharactersFunction(config: EscapeStringCharactersFunctionConfig): EscapeStringCharactersFunction;
|
|
74
93
|
/**
|
|
@@ -76,6 +95,12 @@ export declare function escapeStringCharactersFunction(config: EscapeStringChara
|
|
|
76
95
|
*
|
|
77
96
|
* For instance, `'hello.world'` will be escaped to `'hello\\.world'`.
|
|
78
97
|
*
|
|
98
|
+
* @dbxUtil
|
|
99
|
+
* @dbxUtilCategory string
|
|
100
|
+
* @dbxUtilKind const
|
|
101
|
+
* @dbxUtilTags string, regex, escape, sanitize, pattern
|
|
102
|
+
* @dbxUtilRelated escape-string-characters-function, find-strings-regex-string
|
|
103
|
+
*
|
|
79
104
|
* @param input - The string to escape for regex use.
|
|
80
105
|
* @returns The escaped string with all regex special characters prefixed with a backslash.
|
|
81
106
|
*/
|
|
@@ -91,13 +116,25 @@ export type FindAllCharacterOccurencesFunction = (input: string, max?: Maybe<num
|
|
|
91
116
|
/**
|
|
92
117
|
* Creates a {@link FindAllCharacterOccurencesFunction} that searches for characters from the given set.
|
|
93
118
|
*
|
|
119
|
+
* @dbxUtil
|
|
120
|
+
* @dbxUtilCategory string
|
|
121
|
+
* @dbxUtilKind factory
|
|
122
|
+
* @dbxUtilTags string, search, characters, indices, factory, occurrences
|
|
123
|
+
* @dbxUtilRelated find-all-character-occurences, find-first-character-occurence
|
|
124
|
+
*
|
|
94
125
|
* @param characterSet - The set of characters to search for.
|
|
95
126
|
* @returns A function that finds all occurrences of the configured characters in an input string.
|
|
127
|
+
* @__NO_SIDE_EFFECTS__
|
|
96
128
|
*/
|
|
97
129
|
export declare function findAllCharacterOccurencesFunction(characterSet: Set<string>): FindAllCharacterOccurencesFunction;
|
|
98
130
|
/**
|
|
99
131
|
* Finds all indices of characters from the set that appear in the input string.
|
|
100
132
|
*
|
|
133
|
+
* @dbxUtil
|
|
134
|
+
* @dbxUtilCategory string
|
|
135
|
+
* @dbxUtilTags string, search, characters, indices, occurrences
|
|
136
|
+
* @dbxUtilRelated find-all-character-occurences-function, find-first-character-occurence
|
|
137
|
+
*
|
|
101
138
|
* @param set - The set of characters to search for.
|
|
102
139
|
* @param input - The string to search through.
|
|
103
140
|
* @param max - Optional maximum number of occurrences to return.
|
|
@@ -107,6 +144,11 @@ export declare function findAllCharacterOccurences(set: Set<string>, input: stri
|
|
|
107
144
|
/**
|
|
108
145
|
* Finds the index of the first occurrence of any character from the set in the input string.
|
|
109
146
|
*
|
|
147
|
+
* @dbxUtil
|
|
148
|
+
* @dbxUtilCategory string
|
|
149
|
+
* @dbxUtilTags string, search, characters, first, index, occurrence
|
|
150
|
+
* @dbxUtilRelated find-all-character-occurences, find-all-character-occurences-function
|
|
151
|
+
*
|
|
110
152
|
* @param set - The set of characters to search for.
|
|
111
153
|
* @param input - The string to search through.
|
|
112
154
|
* @returns The zero-based index of the first matching character, or `undefined` if none found.
|
|
@@ -126,13 +168,25 @@ export type SplitStringAtFirstCharacterOccurenceFunction = (input: string) => Sp
|
|
|
126
168
|
/**
|
|
127
169
|
* Creates a function that splits a string into two parts at the first occurrence of any character in the configured set.
|
|
128
170
|
*
|
|
171
|
+
* @dbxUtil
|
|
172
|
+
* @dbxUtilCategory string
|
|
173
|
+
* @dbxUtilKind factory
|
|
174
|
+
* @dbxUtilTags string, split, characters, occurrence, factory
|
|
175
|
+
* @dbxUtilRelated split-string-at-first-character-occurence, keep-characters-after-first-character-occurence-function
|
|
176
|
+
*
|
|
129
177
|
* @param splitAt - A single character or set of characters to split on.
|
|
130
178
|
* @returns A function that splits input strings at the first matching character.
|
|
179
|
+
* @__NO_SIDE_EFFECTS__
|
|
131
180
|
*/
|
|
132
181
|
export declare function splitStringAtFirstCharacterOccurenceFunction(splitAt: string | Set<string>): SplitStringAtFirstCharacterOccurenceFunction;
|
|
133
182
|
/**
|
|
134
183
|
* Splits the input string into two parts at the first occurrence of any character in the split set.
|
|
135
184
|
*
|
|
185
|
+
* @dbxUtil
|
|
186
|
+
* @dbxUtilCategory string
|
|
187
|
+
* @dbxUtilTags string, split, characters, occurrence, tuple
|
|
188
|
+
* @dbxUtilRelated split-string-at-first-character-occurence-function, find-first-character-occurence
|
|
189
|
+
*
|
|
136
190
|
* @param input - The string to split.
|
|
137
191
|
* @param splitAt - A single character or set of characters to split on.
|
|
138
192
|
* @returns A tuple of [before, after], where `after` is `undefined` if no split character was found.
|
|
@@ -147,13 +201,25 @@ export type KeepCharactersAfterFirstCharacterOccurenceFunction = (input: string)
|
|
|
147
201
|
/**
|
|
148
202
|
* Creates a function that returns only the characters after the first occurrence of any character in the configured set.
|
|
149
203
|
*
|
|
204
|
+
* @dbxUtil
|
|
205
|
+
* @dbxUtilCategory string
|
|
206
|
+
* @dbxUtilKind factory
|
|
207
|
+
* @dbxUtilTags string, keep, after, occurrence, factory, suffix
|
|
208
|
+
* @dbxUtilRelated keep-characters-after-first-character-occurence, remove-characters-after-first-character-occurence-function
|
|
209
|
+
*
|
|
150
210
|
* @param findCharacters - A single character or set of characters to search for.
|
|
151
211
|
* @returns A function that extracts the substring after the first matching character, or an empty string if none found.
|
|
212
|
+
* @__NO_SIDE_EFFECTS__
|
|
152
213
|
*/
|
|
153
214
|
export declare function keepCharactersAfterFirstCharacterOccurenceFunction(findCharacters: string | Set<string>): KeepCharactersAfterFirstCharacterOccurenceFunction;
|
|
154
215
|
/**
|
|
155
216
|
* Returns only the characters after the first occurrence of any character from the find set.
|
|
156
217
|
*
|
|
218
|
+
* @dbxUtil
|
|
219
|
+
* @dbxUtilCategory string
|
|
220
|
+
* @dbxUtilTags string, keep, after, occurrence, suffix
|
|
221
|
+
* @dbxUtilRelated keep-characters-after-first-character-occurence-function, remove-characters-after-first-character-occurence
|
|
222
|
+
*
|
|
157
223
|
* @param input - The string to search through.
|
|
158
224
|
* @param findCharacters - A single character or set of characters to search for.
|
|
159
225
|
* @returns The substring after the first matching character, or an empty string if none found.
|
|
@@ -166,13 +232,25 @@ export type RemoveCharactersAfterFirstCharacterOccurenceFunction = (input: strin
|
|
|
166
232
|
/**
|
|
167
233
|
* Creates a function that removes all characters after (and including) the first occurrence of any character in the configured set.
|
|
168
234
|
*
|
|
235
|
+
* @dbxUtil
|
|
236
|
+
* @dbxUtilCategory string
|
|
237
|
+
* @dbxUtilKind factory
|
|
238
|
+
* @dbxUtilTags string, remove, truncate, occurrence, factory, prefix
|
|
239
|
+
* @dbxUtilRelated remove-characters-after-first-character-occurence, keep-characters-after-first-character-occurence-function
|
|
240
|
+
*
|
|
169
241
|
* @param findCharacters - A single character or set of characters to search for.
|
|
170
242
|
* @returns A function that truncates input strings at the first matching character.
|
|
243
|
+
* @__NO_SIDE_EFFECTS__
|
|
171
244
|
*/
|
|
172
245
|
export declare function removeCharactersAfterFirstCharacterOccurenceFunction(findCharacters: string | Set<string>): RemoveCharactersAfterFirstCharacterOccurenceFunction;
|
|
173
246
|
/**
|
|
174
247
|
* Removes all characters after (and including) the first occurrence of any character from the find set.
|
|
175
248
|
*
|
|
249
|
+
* @dbxUtil
|
|
250
|
+
* @dbxUtilCategory string
|
|
251
|
+
* @dbxUtilTags string, remove, truncate, occurrence, prefix
|
|
252
|
+
* @dbxUtilRelated remove-characters-after-first-character-occurence-function, keep-characters-after-first-character-occurence
|
|
253
|
+
*
|
|
176
254
|
* @param input - The string to truncate.
|
|
177
255
|
* @param findCharacters - A single character or set of characters to search for.
|
|
178
256
|
* @returns The substring before the first matching character, or the full string if none found.
|
|
@@ -34,8 +34,15 @@ export type SearchStringFilterFunctionConfigInput<T> = ReadKeyFunction<T, string
|
|
|
34
34
|
/**
|
|
35
35
|
* Creates a {@link SearchStringFilterFunction} that filters values based on whether their string representation matches the filter text.
|
|
36
36
|
*
|
|
37
|
+
* @dbxUtil
|
|
38
|
+
* @dbxUtilCategory string
|
|
39
|
+
* @dbxUtilKind factory
|
|
40
|
+
* @dbxUtilTags string, search, filter, factory, match, decision
|
|
41
|
+
* @dbxUtilRelated case-insensitive-filter-by-index-of-decision-factory
|
|
42
|
+
*
|
|
37
43
|
* @param config - A read function or full configuration specifying how to extract and match search strings.
|
|
38
44
|
* @returns A function that filters an array of values by a search/filter text string.
|
|
45
|
+
* @__NO_SIDE_EFFECTS__
|
|
39
46
|
*/
|
|
40
47
|
export declare function searchStringFilterFunction<T>(config: SearchStringFilterFunctionConfigInput<T>): SearchStringFilterFunction<T>;
|
|
41
48
|
/**
|
package/src/lib/string/sort.d.ts
CHANGED
|
@@ -7,8 +7,15 @@ export type SortByStringFunction<T> = SortCompareFunction<T>;
|
|
|
7
7
|
/**
|
|
8
8
|
* Creates a {@link SortByStringFunction} that sorts values in ascending alphabetical order using `localeCompare`.
|
|
9
9
|
*
|
|
10
|
+
* @dbxUtil
|
|
11
|
+
* @dbxUtilCategory string
|
|
12
|
+
* @dbxUtilKind factory
|
|
13
|
+
* @dbxUtilTags string, sort, compare, alphabetical, factory, locale
|
|
14
|
+
* @dbxUtilRelated sort-by-label-function
|
|
15
|
+
*
|
|
10
16
|
* @param readStringFn - Function to extract a string from each value for comparison.
|
|
11
17
|
* @returns A comparator function suitable for use with `Array.sort()`.
|
|
18
|
+
* @__NO_SIDE_EFFECTS__
|
|
12
19
|
*/
|
|
13
20
|
export declare function sortByStringFunction<T>(readStringFn: ReadStringFunction<T>): SortByStringFunction<T>;
|
|
14
21
|
/**
|
|
@@ -298,6 +298,7 @@ export type CutStringFunction = ((input: string) => string) & ((input: Maybe<str
|
|
|
298
298
|
*
|
|
299
299
|
* @param config - configuration controlling max length and end text behavior
|
|
300
300
|
* @returns a reusable function that truncates input strings
|
|
301
|
+
* @__NO_SIDE_EFFECTS__
|
|
301
302
|
*/
|
|
302
303
|
export declare function cutStringFunction(config: CutStringFunctionConfig): CutStringFunction;
|
|
303
304
|
/**
|
|
@@ -3,22 +3,40 @@ import { type Maybe } from '../value/maybe.type';
|
|
|
3
3
|
/**
|
|
4
4
|
* Trims leading and trailing whitespace from a string.
|
|
5
5
|
*
|
|
6
|
+
* @dbxUtil
|
|
7
|
+
* @dbxUtilCategory string
|
|
8
|
+
* @dbxUtilTags string, trim, whitespace, transform
|
|
9
|
+
* @dbxUtilRelated transform-string-function
|
|
10
|
+
*
|
|
6
11
|
* @param input The string to trim.
|
|
7
12
|
* @returns The trimmed string.
|
|
13
|
+
* @__NO_SIDE_EFFECTS__
|
|
8
14
|
*/
|
|
9
15
|
export declare function stringTrimFunction(input: string): string;
|
|
10
16
|
/**
|
|
11
17
|
* Converts a string to uppercase.
|
|
12
18
|
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory string
|
|
21
|
+
* @dbxUtilTags string, uppercase, case, transform
|
|
22
|
+
* @dbxUtilRelated string-to-lowercase-function, transform-string-function
|
|
23
|
+
*
|
|
13
24
|
* @param input The string to convert.
|
|
14
25
|
* @returns The uppercase string.
|
|
26
|
+
* @__NO_SIDE_EFFECTS__
|
|
15
27
|
*/
|
|
16
28
|
export declare function stringToUppercaseFunction(input: string): string;
|
|
17
29
|
/**
|
|
18
30
|
* Converts a string to lowercase.
|
|
19
31
|
*
|
|
32
|
+
* @dbxUtil
|
|
33
|
+
* @dbxUtilCategory string
|
|
34
|
+
* @dbxUtilTags string, lowercase, case, transform
|
|
35
|
+
* @dbxUtilRelated string-to-uppercase-function, transform-string-function
|
|
36
|
+
*
|
|
20
37
|
* @param input The string to convert.
|
|
21
38
|
* @returns The lowercase string.
|
|
39
|
+
* @__NO_SIDE_EFFECTS__
|
|
22
40
|
*/
|
|
23
41
|
export declare function stringToLowercaseFunction(input: string): string;
|
|
24
42
|
/**
|
|
@@ -97,9 +115,16 @@ export declare function transformStringFunctionConfig<S extends string = string>
|
|
|
97
115
|
* 4. Lowercase conversion (if `config.toLowercase` is true and no `config.transform` or `config.toUppercase`).
|
|
98
116
|
* If no transformations are specified, the identity function is returned.
|
|
99
117
|
*
|
|
118
|
+
* @dbxUtil
|
|
119
|
+
* @dbxUtilCategory string
|
|
120
|
+
* @dbxUtilKind factory
|
|
121
|
+
* @dbxUtilTags string, transform, trim, case, slice, factory
|
|
122
|
+
* @dbxUtilRelated string-trim-function, string-to-uppercase-function, string-to-lowercase-function, slice-string-function
|
|
123
|
+
*
|
|
100
124
|
* @template S The specific string type, defaults to `string`.
|
|
101
125
|
* @param config The `TransformStringFunctionConfig` detailing the transformations.
|
|
102
126
|
* @returns A `TransformStringFunction` that applies the configured transformations.
|
|
127
|
+
* @__NO_SIDE_EFFECTS__
|
|
103
128
|
*/
|
|
104
129
|
export declare function transformStringFunction<S extends string = string>(config: TransformStringFunctionConfig<S>): TransformStringFunction<S>;
|
|
105
130
|
/**
|
|
@@ -117,8 +142,15 @@ export type AddPrefixFunction = (input: string) => string;
|
|
|
117
142
|
/**
|
|
118
143
|
* Creates a function that adds a configured prefix to the input string if it does not exist on that string.
|
|
119
144
|
*
|
|
145
|
+
* @dbxUtil
|
|
146
|
+
* @dbxUtilCategory string
|
|
147
|
+
* @dbxUtilKind factory
|
|
148
|
+
* @dbxUtilTags string, prefix, add, factory
|
|
149
|
+
* @dbxUtilRelated add-prefix, add-suffix-function
|
|
150
|
+
*
|
|
120
151
|
* @param prefix The prefix to add.
|
|
121
152
|
* @returns A function that adds the prefix to a string.
|
|
153
|
+
* @__NO_SIDE_EFFECTS__
|
|
122
154
|
*/
|
|
123
155
|
export declare function addPrefixFunction(prefix: string): AddPrefixFunction;
|
|
124
156
|
/**
|
|
@@ -136,8 +168,15 @@ export declare function addSuffix(suffix: string, input: string): string;
|
|
|
136
168
|
/**
|
|
137
169
|
* Creates a function that adds a configured suffix to the input string if it does not exist on that string.
|
|
138
170
|
*
|
|
171
|
+
* @dbxUtil
|
|
172
|
+
* @dbxUtilCategory string
|
|
173
|
+
* @dbxUtilKind factory
|
|
174
|
+
* @dbxUtilTags string, suffix, add, factory
|
|
175
|
+
* @dbxUtilRelated add-suffix, add-prefix-function
|
|
176
|
+
*
|
|
139
177
|
* @param suffix The suffix to add.
|
|
140
178
|
* @returns A function that adds the suffix to a string.
|
|
179
|
+
* @__NO_SIDE_EFFECTS__
|
|
141
180
|
*/
|
|
142
181
|
export declare function addSuffixFunction(suffix: string): AddSuffixFunction;
|
|
143
182
|
/**
|
|
@@ -147,9 +186,16 @@ export type PadStartFunction = TransformStringFunction;
|
|
|
147
186
|
/**
|
|
148
187
|
* Pads the start of a string to a minimum length.
|
|
149
188
|
*
|
|
189
|
+
* @dbxUtil
|
|
190
|
+
* @dbxUtilCategory string
|
|
191
|
+
* @dbxUtilKind factory
|
|
192
|
+
* @dbxUtilTags string, pad, start, factory, minimum-length
|
|
193
|
+
* @dbxUtilRelated transform-string-function
|
|
194
|
+
*
|
|
150
195
|
* @param minLength The minimum length of the string.
|
|
151
196
|
* @param padCharacter The character to use for padding.
|
|
152
197
|
* @returns A function that pads the start of a string.
|
|
198
|
+
* @__NO_SIDE_EFFECTS__
|
|
153
199
|
*/
|
|
154
200
|
export declare function padStartFunction(minLength: number, padCharacter: string): PadStartFunction;
|
|
155
201
|
/**
|
|
@@ -182,7 +228,14 @@ export interface SliceStringFunctionConfig {
|
|
|
182
228
|
/**
|
|
183
229
|
* Creates a function that slices and concats parts of a string based on the configuration.
|
|
184
230
|
*
|
|
231
|
+
* @dbxUtil
|
|
232
|
+
* @dbxUtilCategory string
|
|
233
|
+
* @dbxUtilKind factory
|
|
234
|
+
* @dbxUtilTags string, slice, take, factory, from-start, from-end
|
|
235
|
+
* @dbxUtilRelated transform-string-function
|
|
236
|
+
*
|
|
185
237
|
* @param config The configuration for the slice function.
|
|
186
238
|
* @returns A SliceStringFunction.
|
|
239
|
+
* @__NO_SIDE_EFFECTS__
|
|
187
240
|
*/
|
|
188
241
|
export declare function sliceStringFunction(config: SliceStringFunctionConfig): SliceStringFunction;
|
package/src/lib/string/tree.d.ts
CHANGED
|
@@ -91,8 +91,15 @@ export type SplitStringTreeFactoryConfig<M = unknown> = AddToSplitStringTreeInpu
|
|
|
91
91
|
/**
|
|
92
92
|
* Creates a {@link SplitStringTreeFactory} that builds tree structures by splitting strings on the configured separator.
|
|
93
93
|
*
|
|
94
|
+
* @dbxUtil
|
|
95
|
+
* @dbxUtilCategory string
|
|
96
|
+
* @dbxUtilKind factory
|
|
97
|
+
* @dbxUtilTags string, tree, split, separator, factory, hierarchy
|
|
98
|
+
* @dbxUtilRelated add-to-split-string-tree, find-best-split-string-tree-match
|
|
99
|
+
*
|
|
94
100
|
* @param config - Configuration specifying the separator and optional metadata merge strategy.
|
|
95
101
|
* @returns A factory function that creates or extends split string trees.
|
|
102
|
+
* @__NO_SIDE_EFFECTS__
|
|
96
103
|
*/
|
|
97
104
|
export declare function splitStringTreeFactory<M = unknown>(config: SplitStringTreeFactoryConfig<M>): SplitStringTreeFactory<M>;
|
|
98
105
|
/**
|
package/src/lib/string/url.d.ts
CHANGED
|
@@ -340,8 +340,15 @@ export interface IsolateWebsitePathFunctionConfig {
|
|
|
340
340
|
/**
|
|
341
341
|
* Creates an {@link IsolateWebsitePathFunction} that extracts and transforms a path from a website URL based on the configuration.
|
|
342
342
|
*
|
|
343
|
+
* @dbxUtil
|
|
344
|
+
* @dbxUtilCategory string
|
|
345
|
+
* @dbxUtilKind factory
|
|
346
|
+
* @dbxUtilTags string, url, path, isolate, transform, factory, query
|
|
347
|
+
* @dbxUtilRelated website-path-from-website-url, website-path-and-query-pair, fix-extra-query-parameters
|
|
348
|
+
*
|
|
343
349
|
* @param config - Configuration for path isolation, including base path removal, component range, query handling, and trailing slash behavior.
|
|
344
350
|
* @returns A function that isolates the configured portion of a website path.
|
|
351
|
+
* @__NO_SIDE_EFFECTS__
|
|
345
352
|
*/
|
|
346
353
|
export declare function isolateWebsitePathFunction(config?: IsolateWebsitePathFunctionConfig): IsolateWebsitePathFunction;
|
|
347
354
|
/**
|
|
@@ -28,5 +28,6 @@ export type ExpandFlattenTreeFunction<T, V> = (values: T[]) => V[];
|
|
|
28
28
|
* @param expand An ExpandTreeFunction (values: T[]) => N[] that converts an array of T into an array of tree nodes N.
|
|
29
29
|
* @param flatten A FlattenTreeFunction (tree: N, array?: V[]) => V[] that flattens a tree of N nodes into an array of V values.
|
|
30
30
|
* @returns An ExpandFlattenTreeFunction (values: T[]) => V[] that performs the combined expansion and flattening.
|
|
31
|
+
* @__NO_SIDE_EFFECTS__
|
|
31
32
|
*/
|
|
32
33
|
export declare function expandFlattenTreeFunction<T, V, N extends TreeNode<T, N> = TreeNode<T, any>>(expand: ExpandTreeFunction<T, N>, flatten: FlattenTreeFunction<N, V>): ExpandFlattenTreeFunction<T, V>;
|
|
@@ -120,6 +120,7 @@ export type ExploreTreeFunction<N extends TreeNode<unknown, N>, V> = (trees: Arr
|
|
|
120
120
|
* visited.push(id);
|
|
121
121
|
* });
|
|
122
122
|
* ```
|
|
123
|
+
* @__NO_SIDE_EFFECTS__
|
|
123
124
|
*/
|
|
124
125
|
export declare function exploreTreeFunction<N extends TreeNode<unknown, N>, V>(config?: Maybe<ExploreTreeFunctionConfig<N, V>>): ExploreTreeFunction<N, V>;
|
|
125
126
|
/**
|
|
@@ -143,6 +144,7 @@ export declare function exploreTreeFunction<N extends TreeNode<unknown, N>, V>(c
|
|
|
143
144
|
* });
|
|
144
145
|
* // Visits: root -> child1 -> leaf1 -> leaf2 -> child2 -> leaf3
|
|
145
146
|
* ```
|
|
147
|
+
* @__NO_SIDE_EFFECTS__
|
|
146
148
|
*/
|
|
147
149
|
export declare function depthFirstExploreTreeTraversalFactoryFunction<N extends TreeNode<unknown, N>, V>(): ExploreTreeTraversalFactoryFunction<N, V>;
|
|
148
150
|
/**
|
|
@@ -166,5 +168,6 @@ export declare function depthFirstExploreTreeTraversalFactoryFunction<N extends
|
|
|
166
168
|
* });
|
|
167
169
|
* // Visits: root -> child1, child2, child3 -> leaf1, leaf2, leaf3
|
|
168
170
|
* ```
|
|
171
|
+
* @__NO_SIDE_EFFECTS__
|
|
169
172
|
*/
|
|
170
173
|
export declare function breadthFirstExploreTreeTraversalFactoryFunction<N extends TreeNode<unknown, N>, V>(): ExploreTreeTraversalFactoryFunction<N, V>;
|
package/src/lib/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Merge, type
|
|
1
|
+
import { type Merge, type OmitNeverProperties, type PickProperties, type StrictOmit, type UnionToIntersection, type Writable } from 'ts-essentials';
|
|
2
2
|
import { type Maybe } from './value/maybe.type';
|
|
3
3
|
/**
|
|
4
4
|
* Boolean, string or number value.
|
|
@@ -63,6 +63,7 @@ export declare function getFunctionType(x: unknown): Maybe<FunctionType>;
|
|
|
63
63
|
*
|
|
64
64
|
* @param x - The value to check.
|
|
65
65
|
* @returns Whether the value is a non-class function.
|
|
66
|
+
* @__NO_SIDE_EFFECTS__
|
|
66
67
|
*/
|
|
67
68
|
export declare function isNonClassFunction(x: unknown): x is Function;
|
|
68
69
|
/**
|
|
@@ -123,7 +124,7 @@ export type PartialOnKeys<T, K> = K extends keyof T ? Omit<T, K> & Partial<Pick<
|
|
|
123
124
|
/**
|
|
124
125
|
* Returns only properties that have string keys.
|
|
125
126
|
*/
|
|
126
|
-
export type StringKeyProperties<T> =
|
|
127
|
+
export type StringKeyProperties<T> = OmitNeverProperties<{
|
|
127
128
|
[K in keyof T]: K extends string ? T[K] : never;
|
|
128
129
|
}>;
|
|
129
130
|
/**
|
package/src/lib/value/bound.d.ts
CHANGED
|
@@ -179,8 +179,15 @@ export type LatLngBoundTupleFunctionConfig = LatLngBoundFunctionConfig;
|
|
|
179
179
|
* Creates a {@link LatLngBoundTupleFunction} that converts various bound inputs into a `[sw, ne]` tuple,
|
|
180
180
|
* applying optional precision to the resulting points.
|
|
181
181
|
*
|
|
182
|
+
* @dbxUtil
|
|
183
|
+
* @dbxUtilCategory value
|
|
184
|
+
* @dbxUtilKind factory
|
|
185
|
+
* @dbxUtilTags value, lat-lng, bound, tuple, factory, geographic
|
|
186
|
+
* @dbxUtilRelated lat-lng-bound-function, lat-lng-bound
|
|
187
|
+
*
|
|
182
188
|
* @param config - optional configuration for point precision
|
|
183
189
|
* @returns a function that produces bound tuples from flexible inputs
|
|
190
|
+
* @__NO_SIDE_EFFECTS__
|
|
184
191
|
*/
|
|
185
192
|
export declare function latLngBoundTupleFunction(config?: LatLngBoundTupleFunctionConfig): LatLngBoundTupleFunction;
|
|
186
193
|
/**
|
|
@@ -224,12 +231,19 @@ export interface LatLngBoundFunctionConfig {
|
|
|
224
231
|
* @returns a function that produces bounds from flexible inputs
|
|
225
232
|
* @throws {Error} when the input cannot be parsed into a valid bound
|
|
226
233
|
*
|
|
234
|
+
* @dbxUtil
|
|
235
|
+
* @dbxUtilCategory value
|
|
236
|
+
* @dbxUtilKind factory
|
|
237
|
+
* @dbxUtilTags value, lat-lng, bound, factory, geographic, normalize
|
|
238
|
+
* @dbxUtilRelated lat-lng-bound, lat-lng-bound-tuple-function, lat-lng-point-function
|
|
239
|
+
*
|
|
227
240
|
* @example
|
|
228
241
|
* ```ts
|
|
229
242
|
* const fn = latLngBoundFunction({ precision: 3 });
|
|
230
243
|
* const result = fn([{ lat: 20, lng: 20 }, { lat: 30, lng: 30 }]);
|
|
231
244
|
* // result.sw.lat === 20, result.ne.lat === 30
|
|
232
245
|
* ```
|
|
246
|
+
* @__NO_SIDE_EFFECTS__
|
|
233
247
|
*/
|
|
234
248
|
export declare function latLngBoundFunction(config?: LatLngBoundFunctionConfig): LatLngBoundFunction;
|
|
235
249
|
/**
|
|
@@ -281,8 +295,15 @@ export type IsWithinLatLngBoundFunction = LatLngBoundCheckFunction & {
|
|
|
281
295
|
* falls entirely within the specified bound. Points are checked directly; bounds require
|
|
282
296
|
* both corners to be within.
|
|
283
297
|
*
|
|
298
|
+
* @dbxUtil
|
|
299
|
+
* @dbxUtilCategory value
|
|
300
|
+
* @dbxUtilKind factory
|
|
301
|
+
* @dbxUtilTags value, lat-lng, bound, contains, decision, factory, geographic
|
|
302
|
+
* @dbxUtilRelated overlaps-lat-lng-bound-function, is-lat-lng-point-within-lat-lng-bound
|
|
303
|
+
*
|
|
284
304
|
* @param bound - the reference bound to check containment against
|
|
285
305
|
* @returns a function that returns `true` if the input is within the reference bound
|
|
306
|
+
* @__NO_SIDE_EFFECTS__
|
|
286
307
|
*/
|
|
287
308
|
export declare function isWithinLatLngBoundFunction(bound: LatLngBound): IsWithinLatLngBoundFunction;
|
|
288
309
|
/**
|
|
@@ -330,8 +351,15 @@ export declare function latLngBoundOverlapsLatLngBound(a: LatLngBound, b: LatLng
|
|
|
330
351
|
* overlaps the reference bound. Internally converts bounds to rectangles for overlap detection,
|
|
331
352
|
* handling antimeridian wrapping.
|
|
332
353
|
*
|
|
354
|
+
* @dbxUtil
|
|
355
|
+
* @dbxUtilCategory value
|
|
356
|
+
* @dbxUtilKind factory
|
|
357
|
+
* @dbxUtilTags value, lat-lng, bound, overlap, decision, factory, geographic
|
|
358
|
+
* @dbxUtilRelated is-within-lat-lng-bound-function, lat-lng-bound-overlaps-lat-lng-bound
|
|
359
|
+
*
|
|
333
360
|
* @param bound - the reference bound to check overlap against
|
|
334
361
|
* @returns a function that returns `true` if the input overlaps the reference bound
|
|
362
|
+
* @__NO_SIDE_EFFECTS__
|
|
335
363
|
*/
|
|
336
364
|
export declare function overlapsLatLngBoundFunction(bound: LatLngBound): OverlapsLatLngBoundFunction;
|
|
337
365
|
/**
|
|
@@ -27,6 +27,7 @@ export type EqualityComparatorFunction<T> = (a: T, b: T) => boolean;
|
|
|
27
27
|
* safeCompare(null, null); // true
|
|
28
28
|
* safeCompare(null, undefined); // false
|
|
29
29
|
* ```
|
|
30
|
+
* @__NO_SIDE_EFFECTS__
|
|
30
31
|
*/
|
|
31
32
|
export declare function safeEqualityComparatorFunction<T>(compare: EqualityComparatorFunction<T>): EqualityComparatorFunction<Maybe<T>>;
|
|
32
33
|
/**
|
|
@@ -78,9 +79,16 @@ export type CompareEqualityWithValueFromItemsFunction<I, V> = ((a: Maybe<I>, b:
|
|
|
78
79
|
* This is a convenience wrapper around {@link compareEqualityWithValueFromItemsFunctionFactory} that
|
|
79
80
|
* accepts both the value reader and comparator in a single call.
|
|
80
81
|
*
|
|
82
|
+
* @dbxUtil
|
|
83
|
+
* @dbxUtilCategory value
|
|
84
|
+
* @dbxUtilKind factory
|
|
85
|
+
* @dbxUtilTags value, comparator, equality, factory, read
|
|
86
|
+
* @dbxUtilRelated compare-equality-with-value-from-items-function-factory, safe-equality-comparator-function
|
|
87
|
+
*
|
|
81
88
|
* @param readValues - extracts the comparable value from each item
|
|
82
89
|
* @param equalityComparator - compares the extracted values for equality
|
|
83
90
|
* @returns a function that compares two items by their extracted values
|
|
91
|
+
* @__NO_SIDE_EFFECTS__
|
|
84
92
|
*/
|
|
85
93
|
export declare function compareEqualityWithValueFromItemsFunction<I, V>(readValues: ReadValueFunction<I, V>, equalityComparator: EqualityComparatorFunction<V>): CompareEqualityWithValueFromItemsFunction<I, V>;
|
|
86
94
|
/**
|
|
@@ -106,5 +114,13 @@ export type CompareEqualityWithValueFromItemsFunctionFactory<I, V> = ((equalityC
|
|
|
106
114
|
* fn(undefined, undefined); // true
|
|
107
115
|
* fn(0, 1); // false
|
|
108
116
|
* ```
|
|
117
|
+
*
|
|
118
|
+
* @dbxUtil
|
|
119
|
+
* @dbxUtilCategory value
|
|
120
|
+
* @dbxUtilKind factory
|
|
121
|
+
* @dbxUtilTags value, comparator, equality, factory, read, reuse
|
|
122
|
+
* @dbxUtilRelated compare-equality-with-value-from-items-function, safe-equality-comparator-function
|
|
123
|
+
*
|
|
124
|
+
* @__NO_SIDE_EFFECTS__
|
|
109
125
|
*/
|
|
110
126
|
export declare function compareEqualityWithValueFromItemsFunctionFactory<I, V>(readValues: ReadValueFunction<I, V>): CompareEqualityWithValueFromItemsFunctionFactory<I, V>;
|
|
@@ -32,6 +32,7 @@ export type DecisionFunctionFactory<C, I> = FactoryWithRequiredInput<DecisionFun
|
|
|
32
32
|
* const alwaysTrue = decisionFunction(true);
|
|
33
33
|
* alwaysTrue('anything'); // true
|
|
34
34
|
* ```
|
|
35
|
+
* @__NO_SIDE_EFFECTS__
|
|
35
36
|
*/
|
|
36
37
|
export declare function decisionFunction<I>(decision: boolean): DecisionFunction<I>;
|
|
37
38
|
/**
|
|
@@ -72,6 +73,8 @@ export declare const invertDecision: <F extends DecisionFunction<any>>(fn: F, in
|
|
|
72
73
|
* const fn2 = asDecisionFunction(undefined, false);
|
|
73
74
|
* fn2('anything'); // false
|
|
74
75
|
* ```
|
|
76
|
+
*
|
|
77
|
+
* @__NO_SIDE_EFFECTS__
|
|
75
78
|
*/
|
|
76
79
|
export declare function asDecisionFunction<T = unknown>(valueOrFunction: Maybe<boolean | DecisionFunction<T>>, defaultIfUndefined?: boolean): DecisionFunction<T>;
|
|
77
80
|
/**
|
|
@@ -95,5 +98,7 @@ export declare function asDecisionFunction<T = unknown>(valueOrFunction: Maybe<b
|
|
|
95
98
|
* isThree(3); // true
|
|
96
99
|
* isThree(4); // false
|
|
97
100
|
* ```
|
|
101
|
+
*
|
|
102
|
+
* @__NO_SIDE_EFFECTS__
|
|
98
103
|
*/
|
|
99
104
|
export declare function isEqualToValueDecisionFunction<T>(equalityValue: T | DecisionFunction<T>): T extends DecisionFunction<T> ? T : DecisionFunction<T>;
|
package/src/lib/value/equal.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type AreEqualContext<T = unknown> = (x: IterableOrValue<T>) => boolean;
|
|
|
32
32
|
* context(0); // true
|
|
33
33
|
* context(10); // false
|
|
34
34
|
* ```
|
|
35
|
+
* @__NO_SIDE_EFFECTS__
|
|
35
36
|
*/
|
|
36
37
|
export declare function isEqualContext<T>(contextValue: T, fn: EqualityComparatorFunction<T>): IsEqualContext<T>;
|
|
37
38
|
/**
|
|
@@ -58,6 +59,7 @@ export declare function isEqualContext<T>(contextValue: T, fn: EqualityComparato
|
|
|
58
59
|
* context([0, 0, 0]); // true
|
|
59
60
|
* context([0, 1, 2]); // false
|
|
60
61
|
* ```
|
|
62
|
+
* @__NO_SIDE_EFFECTS__
|
|
61
63
|
*/
|
|
62
64
|
export declare function areEqualContext<T>(contextValue: T, fn: EqualityComparatorFunction<T>): AreEqualContext<T>;
|
|
63
65
|
/**
|