@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
|
@@ -21,14 +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
|
+
* @param config - Configuration specifying strings to find and the replacement value.
|
|
25
|
+
* @returns Performs the configured replacements on an input string.
|
|
26
|
+
*
|
|
24
27
|
* @dbxUtil
|
|
25
28
|
* @dbxUtilCategory string
|
|
26
29
|
* @dbxUtilKind factory
|
|
27
30
|
* @dbxUtilTags string, replace, regex, substitute, factory
|
|
28
31
|
* @dbxUtilRelated find-strings-regex-string, escape-string-for-regex
|
|
29
32
|
*
|
|
30
|
-
* @param config - Configuration specifying strings to find and the replacement value.
|
|
31
|
-
* @returns A function that performs the configured replacements on an input string.
|
|
32
33
|
* @__NO_SIDE_EFFECTS__
|
|
33
34
|
*/
|
|
34
35
|
export declare function replaceStringsFunction(config: ReplaceStringsConfig): (input: string) => string;
|
|
@@ -43,13 +44,13 @@ export declare const REGEX_SPECIAL_CHARACTERS_SET: Set<string>;
|
|
|
43
44
|
/**
|
|
44
45
|
* Creates an escaped regex string that matches any of the input values, joined with the OR (`|`) operator.
|
|
45
46
|
*
|
|
47
|
+
* @param find - One or more strings to create a matching regex pattern for.
|
|
48
|
+
* @returns A regex-compatible string with special characters escaped and values joined by `|`.
|
|
49
|
+
*
|
|
46
50
|
* @dbxUtil
|
|
47
51
|
* @dbxUtilCategory string
|
|
48
52
|
* @dbxUtilTags string, regex, escape, alternation, pattern
|
|
49
53
|
* @dbxUtilRelated escape-string-for-regex, replace-strings-function
|
|
50
|
-
*
|
|
51
|
-
* @param find - One or more strings to create a matching regex pattern for.
|
|
52
|
-
* @returns A regex-compatible string with special characters escaped and values joined by `|`.
|
|
53
54
|
*/
|
|
54
55
|
export declare function findStringsRegexString(find: ArrayOrValue<string>): string;
|
|
55
56
|
/**
|
|
@@ -79,14 +80,15 @@ export type EscapeStringCharactersFunction = (input: string) => string;
|
|
|
79
80
|
/**
|
|
80
81
|
* Creates an {@link EscapeStringCharactersFunction} that escapes specific characters in a string using the configured escape strategy.
|
|
81
82
|
*
|
|
83
|
+
* @param config - Configuration specifying which characters to escape and how to escape them.
|
|
84
|
+
* @returns Escapes the configured characters in any input string.
|
|
85
|
+
*
|
|
82
86
|
* @dbxUtil
|
|
83
87
|
* @dbxUtilCategory string
|
|
84
88
|
* @dbxUtilKind factory
|
|
85
89
|
* @dbxUtilTags string, escape, characters, factory, transform
|
|
86
90
|
* @dbxUtilRelated escape-string-for-regex, find-all-character-occurences-function
|
|
87
91
|
*
|
|
88
|
-
* @param config - Configuration specifying which characters to escape and how to escape them.
|
|
89
|
-
* @returns A function that escapes the configured characters in any input string.
|
|
90
92
|
* @__NO_SIDE_EFFECTS__
|
|
91
93
|
*/
|
|
92
94
|
export declare function escapeStringCharactersFunction(config: EscapeStringCharactersFunctionConfig): EscapeStringCharactersFunction;
|
|
@@ -110,48 +112,49 @@ export declare const escapeStringForRegex: EscapeStringCharactersFunction;
|
|
|
110
112
|
*
|
|
111
113
|
* @param input - The string to search through.
|
|
112
114
|
* @param max - Optional maximum number of occurrences to return.
|
|
113
|
-
* @returns
|
|
115
|
+
* @returns The zero-based indices where matching characters were found.
|
|
114
116
|
*/
|
|
115
117
|
export type FindAllCharacterOccurencesFunction = (input: string, max?: Maybe<number>) => number[];
|
|
116
118
|
/**
|
|
117
119
|
* Creates a {@link FindAllCharacterOccurencesFunction} that searches for characters from the given set.
|
|
118
120
|
*
|
|
121
|
+
* @param characterSet - The set of characters to search for.
|
|
122
|
+
* @returns Finds all occurrences of the configured characters in an input string.
|
|
123
|
+
*
|
|
119
124
|
* @dbxUtil
|
|
120
125
|
* @dbxUtilCategory string
|
|
121
126
|
* @dbxUtilKind factory
|
|
122
127
|
* @dbxUtilTags string, search, characters, indices, factory, occurrences
|
|
123
128
|
* @dbxUtilRelated find-all-character-occurences, find-first-character-occurence
|
|
124
129
|
*
|
|
125
|
-
* @param characterSet - The set of characters to search for.
|
|
126
|
-
* @returns A function that finds all occurrences of the configured characters in an input string.
|
|
127
130
|
* @__NO_SIDE_EFFECTS__
|
|
128
131
|
*/
|
|
129
132
|
export declare function findAllCharacterOccurencesFunction(characterSet: Set<string>): FindAllCharacterOccurencesFunction;
|
|
130
133
|
/**
|
|
131
134
|
* Finds all indices of characters from the set that appear in the input string.
|
|
132
135
|
*
|
|
136
|
+
* @param set - The set of characters to search for.
|
|
137
|
+
* @param input - The string to search through.
|
|
138
|
+
* @param max - Optional maximum number of occurrences to return.
|
|
139
|
+
* @returns The zero-based indices where matching characters were found.
|
|
140
|
+
*
|
|
133
141
|
* @dbxUtil
|
|
134
142
|
* @dbxUtilCategory string
|
|
135
143
|
* @dbxUtilTags string, search, characters, indices, occurrences
|
|
136
144
|
* @dbxUtilRelated find-all-character-occurences-function, find-first-character-occurence
|
|
137
|
-
*
|
|
138
|
-
* @param set - The set of characters to search for.
|
|
139
|
-
* @param input - The string to search through.
|
|
140
|
-
* @param max - Optional maximum number of occurrences to return.
|
|
141
|
-
* @returns An array of zero-based indices where matching characters were found.
|
|
142
145
|
*/
|
|
143
146
|
export declare function findAllCharacterOccurences(set: Set<string>, input: string, max?: number): number[];
|
|
144
147
|
/**
|
|
145
148
|
* Finds the index of the first occurrence of any character from the set in the input string.
|
|
146
149
|
*
|
|
150
|
+
* @param set - The set of characters to search for.
|
|
151
|
+
* @param input - The string to search through.
|
|
152
|
+
* @returns The zero-based index of the first matching character, or `undefined` if none found.
|
|
153
|
+
*
|
|
147
154
|
* @dbxUtil
|
|
148
155
|
* @dbxUtilCategory string
|
|
149
156
|
* @dbxUtilTags string, search, characters, first, index, occurrence
|
|
150
157
|
* @dbxUtilRelated find-all-character-occurences, find-all-character-occurences-function
|
|
151
|
-
*
|
|
152
|
-
* @param set - The set of characters to search for.
|
|
153
|
-
* @param input - The string to search through.
|
|
154
|
-
* @returns The zero-based index of the first matching character, or `undefined` if none found.
|
|
155
158
|
*/
|
|
156
159
|
export declare function findFirstCharacterOccurence(set: Set<string>, input: string): Maybe<number>;
|
|
157
160
|
/**
|
|
@@ -160,7 +163,7 @@ export declare function findFirstCharacterOccurence(set: Set<string>, input: str
|
|
|
160
163
|
* The first element is the string before the split character(s).
|
|
161
164
|
* The second element is the string after the split character(s), or is undefined if no split occured.
|
|
162
165
|
*/
|
|
163
|
-
export type SplitStringAtFirstCharacterOccurenceResult = [string, string
|
|
166
|
+
export type SplitStringAtFirstCharacterOccurenceResult = [string, Maybe<string>];
|
|
164
167
|
/**
|
|
165
168
|
* Splits the input string at the configured split character(s).
|
|
166
169
|
*/
|
|
@@ -168,30 +171,31 @@ export type SplitStringAtFirstCharacterOccurenceFunction = (input: string) => Sp
|
|
|
168
171
|
/**
|
|
169
172
|
* Creates a function that splits a string into two parts at the first occurrence of any character in the configured set.
|
|
170
173
|
*
|
|
174
|
+
* @param splitAt - A single character or set of characters to split on.
|
|
175
|
+
* @returns Splits input strings at the first matching character.
|
|
176
|
+
*
|
|
171
177
|
* @dbxUtil
|
|
172
178
|
* @dbxUtilCategory string
|
|
173
179
|
* @dbxUtilKind factory
|
|
174
180
|
* @dbxUtilTags string, split, characters, occurrence, factory
|
|
175
181
|
* @dbxUtilRelated split-string-at-first-character-occurence, keep-characters-after-first-character-occurence-function
|
|
176
182
|
*
|
|
177
|
-
* @param splitAt - A single character or set of characters to split on.
|
|
178
|
-
* @returns A function that splits input strings at the first matching character.
|
|
179
183
|
* @__NO_SIDE_EFFECTS__
|
|
180
184
|
*/
|
|
181
185
|
export declare function splitStringAtFirstCharacterOccurenceFunction(splitAt: string | Set<string>): SplitStringAtFirstCharacterOccurenceFunction;
|
|
182
186
|
/**
|
|
183
187
|
* Splits the input string into two parts at the first occurrence of any character in the split set.
|
|
184
188
|
*
|
|
189
|
+
* @param input - The string to split.
|
|
190
|
+
* @param splitAt - A single character or set of characters to split on.
|
|
191
|
+
* @returns A tuple of [before, after], where `after` is `undefined` if no split character was found.
|
|
192
|
+
*
|
|
185
193
|
* @dbxUtil
|
|
186
194
|
* @dbxUtilCategory string
|
|
187
195
|
* @dbxUtilTags string, split, characters, occurrence, tuple
|
|
188
196
|
* @dbxUtilRelated split-string-at-first-character-occurence-function, find-first-character-occurence
|
|
189
|
-
*
|
|
190
|
-
* @param input - The string to split.
|
|
191
|
-
* @param splitAt - A single character or set of characters to split on.
|
|
192
|
-
* @returns A tuple of [before, after], where `after` is `undefined` if no split character was found.
|
|
193
197
|
*/
|
|
194
|
-
export declare function splitStringAtFirstCharacterOccurence(input: string, splitAt: string | Set<string>): [string, string
|
|
198
|
+
export declare function splitStringAtFirstCharacterOccurence(input: string, splitAt: string | Set<string>): [string, Maybe<string>];
|
|
195
199
|
/**
|
|
196
200
|
* Keeps all characters from the input string after the first character occurence pre-determined by the function.
|
|
197
201
|
*
|
|
@@ -201,28 +205,29 @@ export type KeepCharactersAfterFirstCharacterOccurenceFunction = (input: string)
|
|
|
201
205
|
/**
|
|
202
206
|
* Creates a function that returns only the characters after the first occurrence of any character in the configured set.
|
|
203
207
|
*
|
|
208
|
+
* @param findCharacters - A single character or set of characters to search for.
|
|
209
|
+
* @returns Extracts the substring after the first matching character, or an empty string if none found.
|
|
210
|
+
*
|
|
204
211
|
* @dbxUtil
|
|
205
212
|
* @dbxUtilCategory string
|
|
206
213
|
* @dbxUtilKind factory
|
|
207
214
|
* @dbxUtilTags string, keep, after, occurrence, factory, suffix
|
|
208
215
|
* @dbxUtilRelated keep-characters-after-first-character-occurence, remove-characters-after-first-character-occurence-function
|
|
209
216
|
*
|
|
210
|
-
* @param findCharacters - A single character or set of characters to search for.
|
|
211
|
-
* @returns A function that extracts the substring after the first matching character, or an empty string if none found.
|
|
212
217
|
* @__NO_SIDE_EFFECTS__
|
|
213
218
|
*/
|
|
214
219
|
export declare function keepCharactersAfterFirstCharacterOccurenceFunction(findCharacters: string | Set<string>): KeepCharactersAfterFirstCharacterOccurenceFunction;
|
|
215
220
|
/**
|
|
216
221
|
* Returns only the characters after the first occurrence of any character from the find set.
|
|
217
222
|
*
|
|
223
|
+
* @param input - The string to search through.
|
|
224
|
+
* @param findCharacters - A single character or set of characters to search for.
|
|
225
|
+
* @returns The substring after the first matching character, or an empty string if none found.
|
|
226
|
+
*
|
|
218
227
|
* @dbxUtil
|
|
219
228
|
* @dbxUtilCategory string
|
|
220
229
|
* @dbxUtilTags string, keep, after, occurrence, suffix
|
|
221
230
|
* @dbxUtilRelated keep-characters-after-first-character-occurence-function, remove-characters-after-first-character-occurence
|
|
222
|
-
*
|
|
223
|
-
* @param input - The string to search through.
|
|
224
|
-
* @param findCharacters - A single character or set of characters to search for.
|
|
225
|
-
* @returns The substring after the first matching character, or an empty string if none found.
|
|
226
231
|
*/
|
|
227
232
|
export declare function keepCharactersAfterFirstCharacterOccurence(input: string, findCharacters: string | Set<string>): string;
|
|
228
233
|
/**
|
|
@@ -232,27 +237,28 @@ export type RemoveCharactersAfterFirstCharacterOccurenceFunction = (input: strin
|
|
|
232
237
|
/**
|
|
233
238
|
* Creates a function that removes all characters after (and including) the first occurrence of any character in the configured set.
|
|
234
239
|
*
|
|
240
|
+
* @param findCharacters - A single character or set of characters to search for.
|
|
241
|
+
* @returns Truncates input strings at the first matching character.
|
|
242
|
+
*
|
|
235
243
|
* @dbxUtil
|
|
236
244
|
* @dbxUtilCategory string
|
|
237
245
|
* @dbxUtilKind factory
|
|
238
246
|
* @dbxUtilTags string, remove, truncate, occurrence, factory, prefix
|
|
239
247
|
* @dbxUtilRelated remove-characters-after-first-character-occurence, keep-characters-after-first-character-occurence-function
|
|
240
248
|
*
|
|
241
|
-
* @param findCharacters - A single character or set of characters to search for.
|
|
242
|
-
* @returns A function that truncates input strings at the first matching character.
|
|
243
249
|
* @__NO_SIDE_EFFECTS__
|
|
244
250
|
*/
|
|
245
251
|
export declare function removeCharactersAfterFirstCharacterOccurenceFunction(findCharacters: string | Set<string>): RemoveCharactersAfterFirstCharacterOccurenceFunction;
|
|
246
252
|
/**
|
|
247
253
|
* Removes all characters after (and including) the first occurrence of any character from the find set.
|
|
248
254
|
*
|
|
255
|
+
* @param input - The string to truncate.
|
|
256
|
+
* @param findCharacters - A single character or set of characters to search for.
|
|
257
|
+
* @returns The substring before the first matching character, or the full string if none found.
|
|
258
|
+
*
|
|
249
259
|
* @dbxUtil
|
|
250
260
|
* @dbxUtilCategory string
|
|
251
261
|
* @dbxUtilTags string, remove, truncate, occurrence, prefix
|
|
252
262
|
* @dbxUtilRelated remove-characters-after-first-character-occurence-function, keep-characters-after-first-character-occurence
|
|
253
|
-
*
|
|
254
|
-
* @param input - The string to truncate.
|
|
255
|
-
* @param findCharacters - A single character or set of characters to search for.
|
|
256
|
-
* @returns The substring before the first matching character, or the full string if none found.
|
|
257
263
|
*/
|
|
258
264
|
export declare function removeCharactersAfterFirstCharacterOccurence(input: string, findCharacters: string | Set<string>): string;
|
|
@@ -17,13 +17,13 @@ export interface SearchStringFilterConfig<T> {
|
|
|
17
17
|
/**
|
|
18
18
|
* Reads the search value(s) from the input item to compare against the filter text.
|
|
19
19
|
*/
|
|
20
|
-
readStrings: ReadKeyFunction<T, string> | ReadMultipleKeysFunction<T, string>;
|
|
20
|
+
readonly readStrings: ReadKeyFunction<T, string> | ReadMultipleKeysFunction<T, string>;
|
|
21
21
|
/**
|
|
22
22
|
* Optional decision function factory for matching logic.
|
|
23
23
|
*
|
|
24
24
|
* Defaults to {@link caseInsensitiveFilterByIndexOfDecisionFactory} if not defined.
|
|
25
25
|
*/
|
|
26
|
-
decisionFactory?: SearchStringDecisionFunctionFactory;
|
|
26
|
+
readonly decisionFactory?: SearchStringDecisionFunctionFactory;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Input for creating a {@link SearchStringFilterFunction}. Can be a read function directly or a full config object.
|
|
@@ -34,14 +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
|
+
* @param config - A read function or full configuration specifying how to extract and match search strings.
|
|
38
|
+
* @returns Filters an array of values by a search/filter text string.
|
|
39
|
+
*
|
|
37
40
|
* @dbxUtil
|
|
38
41
|
* @dbxUtilCategory string
|
|
39
42
|
* @dbxUtilKind factory
|
|
40
43
|
* @dbxUtilTags string, search, filter, factory, match, decision
|
|
41
44
|
* @dbxUtilRelated case-insensitive-filter-by-index-of-decision-factory
|
|
42
45
|
*
|
|
43
|
-
* @param config - A read function or full configuration specifying how to extract and match search strings.
|
|
44
|
-
* @returns A function that filters an array of values by a search/filter text string.
|
|
45
46
|
* @__NO_SIDE_EFFECTS__
|
|
46
47
|
*/
|
|
47
48
|
export declare function searchStringFilterFunction<T>(config: SearchStringFilterFunctionConfigInput<T>): SearchStringFilterFunction<T>;
|
package/src/lib/string/sort.d.ts
CHANGED
|
@@ -11,9 +11,13 @@ export type SortByStringFunction<T> = SortCompareFunction<T>;
|
|
|
11
11
|
* `(a, b) => a.localeCompare(b)` everywhere, and to satisfy the no-default-sort
|
|
12
12
|
* lint rule for string arrays.
|
|
13
13
|
*
|
|
14
|
+
* @param a - The first string to compare.
|
|
15
|
+
* @param b - The second string to compare.
|
|
16
|
+
* @returns A negative number when `a` sorts before `b`, positive when after, `0` when equal.
|
|
17
|
+
*
|
|
14
18
|
* @dbxUtil
|
|
15
19
|
* @dbxUtilCategory string
|
|
16
|
-
* @dbxUtilKind
|
|
20
|
+
* @dbxUtilKind const
|
|
17
21
|
* @dbxUtilTags string, sort, compare, alphabetical, locale
|
|
18
22
|
* @dbxUtilRelated compare-strings-numeric, sort-by-string-function
|
|
19
23
|
*
|
|
@@ -28,9 +32,13 @@ export declare const compareStrings: SortByStringFunction<string>;
|
|
|
28
32
|
* with the `numeric` collation option enabled, so numeric substrings are compared by value
|
|
29
33
|
* (e.g. `"2"` sorts before `"10"`).
|
|
30
34
|
*
|
|
35
|
+
* @param a - The first string to compare.
|
|
36
|
+
* @param b - The second string to compare.
|
|
37
|
+
* @returns A negative number when `a` sorts before `b`, positive when after, `0` when equal.
|
|
38
|
+
*
|
|
31
39
|
* @dbxUtil
|
|
32
40
|
* @dbxUtilCategory string
|
|
33
|
-
* @dbxUtilKind
|
|
41
|
+
* @dbxUtilKind const
|
|
34
42
|
* @dbxUtilTags string, sort, compare, numeric, natural, locale
|
|
35
43
|
* @dbxUtilRelated compare-strings, sort-by-string-function
|
|
36
44
|
*
|
|
@@ -43,14 +51,15 @@ export declare const compareStringsNumeric: SortByStringFunction<string>;
|
|
|
43
51
|
/**
|
|
44
52
|
* Creates a {@link SortByStringFunction} that sorts values in ascending alphabetical order using `localeCompare`.
|
|
45
53
|
*
|
|
54
|
+
* @param readStringFn - Function to extract a string from each value for comparison.
|
|
55
|
+
* @returns A comparator function suitable for use with `Array.sort()`.
|
|
56
|
+
*
|
|
46
57
|
* @dbxUtil
|
|
47
58
|
* @dbxUtilCategory string
|
|
48
59
|
* @dbxUtilKind factory
|
|
49
60
|
* @dbxUtilTags string, sort, compare, alphabetical, factory, locale
|
|
50
61
|
* @dbxUtilRelated sort-by-label-function, compare-strings
|
|
51
62
|
*
|
|
52
|
-
* @param readStringFn - Function to extract a string from each value for comparison.
|
|
53
|
-
* @returns A comparator function suitable for use with `Array.sort()`.
|
|
54
63
|
* @__NO_SIDE_EFFECTS__
|
|
55
64
|
*/
|
|
56
65
|
export declare function sortByStringFunction<T>(readStringFn: ReadStringFunction<T>): SortByStringFunction<T>;
|
|
@@ -58,15 +58,15 @@ export declare function joinStrings(input: ArrayOrValue<Maybe<string>>, joiner?:
|
|
|
58
58
|
* Splits a string like {@link String.prototype.split}, but joins overflow segments back together
|
|
59
59
|
* instead of discarding them. Useful when you only want to split on the first N-1 occurrences.
|
|
60
60
|
*
|
|
61
|
+
* @param input - String to split.
|
|
62
|
+
* @param separator - Delimiter to split on.
|
|
63
|
+
* @param limit - Maximum number of resulting segments; overflow segments are rejoined with the separator.
|
|
64
|
+
* @returns Array of string segments, with length at most equal to limit.
|
|
65
|
+
*
|
|
61
66
|
* @dbxUtil
|
|
62
67
|
* @dbxUtilCategory string
|
|
63
68
|
* @dbxUtilTags string, split, limit, separator, parts, segments
|
|
64
69
|
* @dbxUtilRelated join-strings, string-split-join-instance
|
|
65
|
-
*
|
|
66
|
-
* @param input - string to split
|
|
67
|
-
* @param separator - delimiter to split on
|
|
68
|
-
* @param limit - maximum number of resulting segments; overflow segments are rejoined with the separator
|
|
69
|
-
* @returns array of string segments, with length at most equal to limit
|
|
70
70
|
*/
|
|
71
71
|
export declare function splitJoinRemainder(input: string, separator: string, limit: number): string[];
|
|
72
72
|
/**
|
|
@@ -106,15 +106,15 @@ export interface JoinStringsInstanceConfig {
|
|
|
106
106
|
/**
|
|
107
107
|
* Creates a {@link JoinStringsInstance} that joins arrays of strings using the configured delimiter.
|
|
108
108
|
*
|
|
109
|
+
* @param config - Configuration for the delimiter and default trim behavior.
|
|
110
|
+
* @returns A new callable {@link JoinStringsInstance}
|
|
111
|
+
*
|
|
109
112
|
* @example
|
|
110
113
|
* ```ts
|
|
111
114
|
* const joinWithPipe = joinStringsInstance({ joiner: '|' });
|
|
112
115
|
* joinWithPipe(['a', 'b']); // 'a|b'
|
|
113
116
|
* joinWithPipe(null); // null
|
|
114
117
|
* ```
|
|
115
|
-
*
|
|
116
|
-
* @param config - configuration for the delimiter and default trim behavior
|
|
117
|
-
* @returns a new callable {@link JoinStringsInstance}
|
|
118
118
|
*/
|
|
119
119
|
export declare function joinStringsInstance<T extends string = string>(config: JoinStringsInstanceConfig): JoinStringsInstance<T>;
|
|
120
120
|
/**
|
|
@@ -163,15 +163,15 @@ export type StringSplitJoinInstanceConfig = JoinStringsInstanceConfig;
|
|
|
163
163
|
/**
|
|
164
164
|
* Creates a {@link StringSplitJoinInstance} that splits and joins strings using the configured delimiter.
|
|
165
165
|
*
|
|
166
|
+
* @param config - Configuration for the delimiter and default trim behavior.
|
|
167
|
+
* @returns A new {@link StringSplitJoinInstance}
|
|
168
|
+
*
|
|
166
169
|
* @example
|
|
167
170
|
* ```ts
|
|
168
171
|
* const pipeSplitJoin = stringSplitJoinInstance({ joiner: '|' });
|
|
169
172
|
* pipeSplitJoin.joinStrings(['a', 'b']); // 'a|b'
|
|
170
173
|
* pipeSplitJoin.splitStrings('a|b'); // ['a', 'b']
|
|
171
174
|
* ```
|
|
172
|
-
*
|
|
173
|
-
* @param config - configuration for the delimiter and default trim behavior
|
|
174
|
-
* @returns a new {@link StringSplitJoinInstance}
|
|
175
175
|
*/
|
|
176
176
|
export declare function stringSplitJoinInstance<T extends string = string>(config: StringSplitJoinInstanceConfig): StringSplitJoinInstance<T>;
|
|
177
177
|
/**
|
|
@@ -201,62 +201,62 @@ export declare function caseInsensitiveString(input: Maybe<string>): Maybe<strin
|
|
|
201
201
|
*
|
|
202
202
|
* Undefined is returned if a null/undefined value is input.
|
|
203
203
|
*
|
|
204
|
-
* @param value -
|
|
205
|
-
* @param prefix -
|
|
206
|
-
* @returns
|
|
204
|
+
* @param value - The number to prefix.
|
|
205
|
+
* @param prefix - The prefix character to use for positive numbers; defaults to '+'.
|
|
206
|
+
* @returns The prefixed string, or undefined if the input is null/undefined.
|
|
207
207
|
*/
|
|
208
|
-
export declare function addPlusPrefixToNumber(value?: Maybe<number>, prefix?: string): string
|
|
208
|
+
export declare function addPlusPrefixToNumber(value?: Maybe<number>, prefix?: string): Maybe<string>;
|
|
209
209
|
/**
|
|
210
210
|
* Capitalizes the first letter of the input string.
|
|
211
211
|
*
|
|
212
|
+
* @param value - String to capitalize.
|
|
213
|
+
* @returns The input string with its first character uppercased.
|
|
214
|
+
*
|
|
212
215
|
* @dbxUtil
|
|
213
216
|
* @dbxUtilCategory string
|
|
214
217
|
* @dbxUtilTags string, capitalize, case, uppercase, first
|
|
215
218
|
* @dbxUtilRelated lowercase-first-letter, case-insensitive-string
|
|
216
|
-
*
|
|
217
|
-
* @param value - string to capitalize
|
|
218
|
-
* @returns the input string with its first character uppercased
|
|
219
219
|
*/
|
|
220
220
|
export declare function capitalizeFirstLetter(value: string): string;
|
|
221
221
|
/**
|
|
222
222
|
* Lowercases the first letter of the input string.
|
|
223
223
|
*
|
|
224
|
+
* @param value - String to modify.
|
|
225
|
+
* @returns The input string with its first character lowercased.
|
|
226
|
+
*
|
|
224
227
|
* @dbxUtil
|
|
225
228
|
* @dbxUtilCategory string
|
|
226
229
|
* @dbxUtilTags string, lowercase, case, first, decapitalize
|
|
227
230
|
* @dbxUtilRelated capitalize-first-letter, case-insensitive-string
|
|
228
|
-
*
|
|
229
|
-
* @param value - string to modify
|
|
230
|
-
* @returns the input string with its first character lowercased
|
|
231
231
|
*/
|
|
232
232
|
export declare function lowercaseFirstLetter(value: string): string;
|
|
233
233
|
/**
|
|
234
234
|
* A tuple of [firstName, lastName] where lastName may be undefined if the input has no space.
|
|
235
235
|
*/
|
|
236
|
-
export type FirstNameLastNameTuple = [string, string
|
|
236
|
+
export type FirstNameLastNameTuple = [string, Maybe<string>];
|
|
237
237
|
/**
|
|
238
238
|
* Splits the input string into a first name and last name tuple using a space as the delimiter.
|
|
239
239
|
* If the name contains more than one space, the remainder is treated as the last name.
|
|
240
240
|
*
|
|
241
|
+
* @param input - Full name string to split.
|
|
242
|
+
* @returns A tuple of [firstName, lastName], where lastName includes all text after the first space.
|
|
243
|
+
*
|
|
241
244
|
* @dbxUtil
|
|
242
245
|
* @dbxUtilCategory string
|
|
243
246
|
* @dbxUtilTags string, name, split, first, last, person, parse
|
|
244
247
|
* @dbxUtilRelated split-join-remainder
|
|
245
|
-
*
|
|
246
|
-
* @param input - full name string to split
|
|
247
|
-
* @returns a tuple of [firstName, lastName], where lastName includes all text after the first space
|
|
248
248
|
*/
|
|
249
249
|
export declare function splitJoinNameString(input: string): FirstNameLastNameTuple;
|
|
250
250
|
/**
|
|
251
251
|
* Creates a string that repeats the given string a specified number of times.
|
|
252
252
|
*
|
|
253
|
+
* @param string - The string to repeat.
|
|
254
|
+
* @param reapeat - Number of times to repeat the string.
|
|
255
|
+
* @returns The repeated string concatenation.
|
|
256
|
+
*
|
|
253
257
|
* @dbxUtil
|
|
254
258
|
* @dbxUtilCategory string
|
|
255
259
|
* @dbxUtilTags string, repeat, build, generate, fill
|
|
256
|
-
*
|
|
257
|
-
* @param string - the string to repeat
|
|
258
|
-
* @param reapeat - number of times to repeat the string
|
|
259
|
-
* @returns the repeated string concatenation
|
|
260
260
|
*/
|
|
261
261
|
export declare function repeatString(string: string, reapeat: number): string;
|
|
262
262
|
/**
|
|
@@ -285,34 +285,35 @@ export interface CutStringFunctionConfig {
|
|
|
285
285
|
*/
|
|
286
286
|
export declare const DEFAULT_CUT_STRING_END_TEXT = "...";
|
|
287
287
|
/**
|
|
288
|
-
*
|
|
288
|
+
* Truncates a string to a configured maximum length, optionally appending end text.
|
|
289
289
|
*/
|
|
290
290
|
export type CutStringFunction = ((input: string) => string) & ((input: Maybe<string>) => Maybe<string>);
|
|
291
291
|
/**
|
|
292
292
|
* Creates a {@link CutStringFunction} that truncates strings exceeding the configured maximum length.
|
|
293
293
|
*
|
|
294
|
+
* @param config - Configuration controlling max length and end text behavior.
|
|
295
|
+
* @returns A reusable function that truncates input strings.
|
|
296
|
+
*
|
|
294
297
|
* @dbxUtil
|
|
295
298
|
* @dbxUtilCategory string
|
|
296
299
|
* @dbxUtilKind factory
|
|
297
300
|
* @dbxUtilTags string, cut, truncate, ellipsis, max-length, factory, abbreviate
|
|
298
301
|
*
|
|
299
|
-
* @param config - configuration controlling max length and end text behavior
|
|
300
|
-
* @returns a reusable function that truncates input strings
|
|
301
302
|
* @__NO_SIDE_EFFECTS__
|
|
302
303
|
*/
|
|
303
304
|
export declare function cutStringFunction(config: CutStringFunctionConfig): CutStringFunction;
|
|
304
305
|
/**
|
|
305
306
|
* Truncates a string to the given maximum length, appending end text (defaults to "...") if truncated.
|
|
306
307
|
*
|
|
308
|
+
* @param input - The string to truncate, or null/undefined.
|
|
309
|
+
* @param maxLength - Maximum allowed length for the output string.
|
|
310
|
+
* @param endText - Text to append when truncated; defaults to "...".
|
|
311
|
+
* @returns The truncated string, or null/undefined if the input is null/undefined.
|
|
312
|
+
*
|
|
307
313
|
* @dbxUtil
|
|
308
314
|
* @dbxUtilCategory string
|
|
309
315
|
* @dbxUtilTags string, cut, truncate, ellipsis, max-length, abbreviate, shorten
|
|
310
316
|
* @dbxUtilRelated cut-string-function
|
|
311
|
-
*
|
|
312
|
-
* @param input - the string to truncate, or null/undefined
|
|
313
|
-
* @param maxLength - maximum allowed length for the output string
|
|
314
|
-
* @param endText - text to append when truncated; defaults to "..."
|
|
315
|
-
* @returns the truncated string, or null/undefined if the input is null/undefined
|
|
316
317
|
*/
|
|
317
318
|
export declare function cutString(input: Maybe<string>, maxLength: number, endText?: Maybe<string>): Maybe<string>;
|
|
318
319
|
/**
|
|
@@ -320,25 +321,25 @@ export declare function cutString(input: Maybe<string>, maxLength: number, endTe
|
|
|
320
321
|
*
|
|
321
322
|
* Newlines are preserved.
|
|
322
323
|
*
|
|
324
|
+
* @param input - String to flatten.
|
|
325
|
+
* @returns The string with collapsed whitespace.
|
|
326
|
+
*
|
|
323
327
|
* @dbxUtil
|
|
324
328
|
* @dbxUtilCategory string
|
|
325
329
|
* @dbxUtilTags string, whitespace, flatten, collapse, normalize, trim
|
|
326
330
|
* @dbxUtilRelated simplify-whitespace
|
|
327
|
-
*
|
|
328
|
-
* @param input - string to flatten
|
|
329
|
-
* @returns the string with collapsed whitespace
|
|
330
331
|
*/
|
|
331
332
|
export declare function flattenWhitespace(input: string): string;
|
|
332
333
|
/**
|
|
333
334
|
* Reduces multiple consecutive newlines to a single newline and collapses multiple whitespace characters to a single space.
|
|
334
335
|
*
|
|
336
|
+
* @param input - String to simplify.
|
|
337
|
+
* @returns The string with simplified whitespace and newlines.
|
|
338
|
+
*
|
|
335
339
|
* @dbxUtil
|
|
336
340
|
* @dbxUtilCategory string
|
|
337
341
|
* @dbxUtilTags string, whitespace, simplify, normalize, newline, trim
|
|
338
342
|
* @dbxUtilRelated flatten-whitespace
|
|
339
|
-
*
|
|
340
|
-
* @param input - string to simplify
|
|
341
|
-
* @returns the string with simplified whitespace and newlines
|
|
342
343
|
*/
|
|
343
344
|
export declare function simplifyWhitespace(input: string): string;
|
|
344
345
|
/**
|