@dereekb/util 13.11.2 → 13.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/eslint/index.cjs.default.js +1 -0
  2. package/eslint/index.cjs.js +687 -0
  3. package/eslint/index.cjs.mjs +2 -0
  4. package/eslint/index.d.ts +1 -0
  5. package/eslint/index.esm.js +683 -0
  6. package/eslint/package.json +23 -0
  7. package/eslint/src/index.d.ts +1 -0
  8. package/eslint/src/lib/comments.d.ts +101 -0
  9. package/eslint/src/lib/index.d.ts +3 -0
  10. package/eslint/src/lib/plugin.d.ts +18 -0
  11. package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +50 -0
  12. package/eslint/src/lib/require-no-side-effects.rule.d.ts +67 -0
  13. package/fetch/package.json +2 -2
  14. package/index.cjs.js +1421 -23
  15. package/index.esm.js +1421 -24
  16. package/package.json +7 -1
  17. package/src/lib/array/array.factory.d.ts +2 -0
  18. package/src/lib/array/array.filter.d.ts +50 -17
  19. package/src/lib/array/array.find.d.ts +1 -0
  20. package/src/lib/array/array.index.d.ts +7 -0
  21. package/src/lib/array/array.indexed.d.ts +21 -0
  22. package/src/lib/array/array.make.d.ts +7 -0
  23. package/src/lib/array/array.random.d.ts +1 -0
  24. package/src/lib/array/array.unique.d.ts +3 -0
  25. package/src/lib/array/array.value.d.ts +7 -0
  26. package/src/lib/auth/auth.role.claims.d.ts +7 -0
  27. package/src/lib/boolean.d.ts +1 -0
  28. package/src/lib/contact/random.d.ts +14 -0
  29. package/src/lib/date/date.d.ts +229 -0
  30. package/src/lib/date/time.d.ts +7 -0
  31. package/src/lib/date/week.d.ts +7 -0
  32. package/src/lib/error/error.d.ts +7 -0
  33. package/src/lib/filter/filter.d.ts +7 -0
  34. package/src/lib/function/function.boolean.d.ts +7 -0
  35. package/src/lib/function/function.forward.d.ts +14 -0
  36. package/src/lib/getter/getter.cache.d.ts +7 -0
  37. package/src/lib/getter/getter.d.ts +34 -0
  38. package/src/lib/getter/getter.map.d.ts +7 -0
  39. package/src/lib/getter/getter.util.d.ts +7 -0
  40. package/src/lib/grouping.d.ts +8 -0
  41. package/src/lib/hash.d.ts +1 -0
  42. package/src/lib/key.d.ts +16 -0
  43. package/src/lib/map/map.key.d.ts +14 -0
  44. package/src/lib/model/id.batch.d.ts +7 -0
  45. package/src/lib/model/id.factory.d.ts +7 -0
  46. package/src/lib/model/model.conversion.d.ts +35 -0
  47. package/src/lib/model/model.copy.d.ts +7 -0
  48. package/src/lib/model/model.d.ts +19 -0
  49. package/src/lib/model/model.modify.d.ts +14 -0
  50. package/src/lib/nodejs/stream.d.ts +7 -0
  51. package/src/lib/number/bound.d.ts +3 -0
  52. package/src/lib/number/dollar.d.ts +7 -0
  53. package/src/lib/number/factory.d.ts +7 -0
  54. package/src/lib/number/random.d.ts +1 -0
  55. package/src/lib/number/round.d.ts +22 -0
  56. package/src/lib/number/sort.d.ts +7 -0
  57. package/src/lib/number/transform.d.ts +7 -0
  58. package/src/lib/object/object.array.delta.d.ts +7 -0
  59. package/src/lib/object/object.equal.d.ts +7 -0
  60. package/src/lib/object/object.filter.pojo.d.ts +87 -0
  61. package/src/lib/object/object.filter.tuple.d.ts +16 -0
  62. package/src/lib/object/object.key.d.ts +14 -0
  63. package/src/lib/object/object.map.d.ts +14 -0
  64. package/src/lib/path/path.d.ts +9 -0
  65. package/src/lib/promise/promise.d.ts +21 -0
  66. package/src/lib/promise/promise.factory.d.ts +7 -0
  67. package/src/lib/promise/promise.task.d.ts +7 -0
  68. package/src/lib/service/handler.config.d.ts +28 -0
  69. package/src/lib/service/handler.d.ts +14 -0
  70. package/src/lib/set/set.d.ts +21 -0
  71. package/src/lib/set/set.decision.d.ts +7 -0
  72. package/src/lib/set/set.delta.d.ts +7 -0
  73. package/src/lib/set/set.selection.d.ts +7 -0
  74. package/src/lib/sort.d.ts +8 -0
  75. package/src/lib/string/char.d.ts +7 -0
  76. package/src/lib/string/dencoder.d.ts +35 -0
  77. package/src/lib/string/factory.d.ts +22 -1
  78. package/src/lib/string/replace.d.ts +78 -0
  79. package/src/lib/string/search.d.ts +7 -0
  80. package/src/lib/string/sort.d.ts +7 -0
  81. package/src/lib/string/string.d.ts +1 -0
  82. package/src/lib/string/transform.d.ts +53 -0
  83. package/src/lib/string/tree.d.ts +7 -0
  84. package/src/lib/string/url.d.ts +7 -0
  85. package/src/lib/tree/tree.array.d.ts +1 -0
  86. package/src/lib/tree/tree.explore.d.ts +3 -0
  87. package/src/lib/type.d.ts +3 -2
  88. package/src/lib/value/bound.d.ts +28 -0
  89. package/src/lib/value/comparator.d.ts +16 -0
  90. package/src/lib/value/decision.d.ts +5 -0
  91. package/src/lib/value/equal.d.ts +2 -0
  92. package/src/lib/value/indexed.d.ts +127 -0
  93. package/src/lib/value/map.d.ts +22 -0
  94. package/src/lib/value/maybe.type.d.ts +2 -2
  95. package/src/lib/value/modifier.d.ts +13 -0
  96. package/src/lib/value/point.d.ts +56 -0
  97. package/src/lib/value/use.d.ts +37 -0
  98. package/src/lib/value/vector.d.ts +7 -0
  99. package/test/index.cjs.js +17 -4
  100. package/test/index.esm.js +17 -4
  101. package/test/package.json +2 -2
  102. package/test/src/lib/shared/shared.fail.d.ts +24 -5
@@ -69,9 +69,16 @@ export declare const PRIMATIVE_KEY_DENCODER_VALUE: (_input: unknown) => null;
69
69
  * Creates a new {@link PrimativeKeyDencoderFunction} that can bidirectionally encode/decode
70
70
  * primitive key values based on the configured value pairs.
71
71
  *
72
+ * @dbxUtil
73
+ * @dbxUtilCategory string
74
+ * @dbxUtilKind factory
75
+ * @dbxUtilTags string, encode, decode, dencoder, bidirectional, factory, primitive
76
+ * @dbxUtilRelated primative-key-dencoder-map, primative-key-string-dencoder
77
+ *
72
78
  * @param config - configuration with value pairs and optional default fallback
73
79
  * @returns a function that encodes or decodes single values or arrays
74
80
  * @throws Error if a single value lookup produces a null result and no default handles it
81
+ * @__NO_SIDE_EFFECTS__
75
82
  */
76
83
  export declare function primativeKeyDencoder<D extends PrimativeKey, E extends PrimativeKey>(config: PrimativeKeyDencoderConfig<D, E>): PrimativeKeyDencoderFunction<D, E>;
77
84
  /**
@@ -101,9 +108,16 @@ export type PrimativeKeyStringDencoderFunction<D extends PrimativeKey, E extends
101
108
  * When no splitter is defined, all encoded values must be exactly one character long so the string
102
109
  * can be split character-by-character.
103
110
  *
111
+ * @dbxUtil
112
+ * @dbxUtilCategory string
113
+ * @dbxUtilKind factory
114
+ * @dbxUtilTags string, encode, decode, dencoder, splitter, factory, primitive
115
+ * @dbxUtilRelated primative-key-dencoder, primative-key-dencoder-map
116
+ *
104
117
  * @param config - configuration with dencoder and optional splitter
105
118
  * @returns a bidirectional function for string-to-array and array-to-string conversion
106
119
  * @throws Error if encoded values contain the splitter character, or if values exceed one character when no splitter is defined
120
+ * @__NO_SIDE_EFFECTS__
107
121
  */
108
122
  export declare function primativeKeyStringDencoder<D extends PrimativeKey, E extends PrimativeKey>(config: PrimativeKeyStringDencoderConfig<D, E>): PrimativeKeyStringDencoderFunction<D, E>;
109
123
  /**
@@ -211,23 +225,44 @@ export type NumberStringDencoderFunction = ((input: NumberStringDencoderString)
211
225
  * Creates a {@link NumberStringDencoderFunction} from the given dencoder.
212
226
  * The returned function auto-detects the input type: numbers are encoded, strings are decoded.
213
227
  *
228
+ * @dbxUtil
229
+ * @dbxUtilCategory string
230
+ * @dbxUtilKind factory
231
+ * @dbxUtilTags string, number, encode, decode, dencoder, bidirectional, factory
232
+ * @dbxUtilRelated number-string-dencoder, number-string-dencoder-encoded-string-value-function, number-string-dencoder-decoded-number-value-function
233
+ *
214
234
  * @param dencoder - the NumberStringDencoder to wrap
215
235
  * @returns a bidirectional encode/decode function
236
+ * @__NO_SIDE_EFFECTS__
216
237
  */
217
238
  export declare function numberStringDencoderFunction(dencoder: NumberStringDencoder): NumberStringDencoderFunction;
218
239
  /**
219
240
  * Creates a function that always returns the encoded string form of the input.
220
241
  * Numbers are encoded; strings are passed through as-is.
221
242
  *
243
+ * @dbxUtil
244
+ * @dbxUtilCategory string
245
+ * @dbxUtilKind factory
246
+ * @dbxUtilTags string, number, encode, normalize, factory
247
+ * @dbxUtilRelated number-string-dencoder-function, number-string-dencoder-decoded-number-value-function
248
+ *
222
249
  * @param dencoder - the NumberStringDencoder to use for encoding
223
250
  * @returns a function that normalizes input to an encoded string
251
+ * @__NO_SIDE_EFFECTS__
224
252
  */
225
253
  export declare function numberStringDencoderEncodedStringValueFunction(dencoder: NumberStringDencoder): (input: NumberStringDencoderString | NumberStringDencoderNumber) => NumberStringDencoderString;
226
254
  /**
227
255
  * Creates a function that always returns the decoded number form of the input.
228
256
  * Strings are decoded; numbers are passed through as-is.
229
257
  *
258
+ * @dbxUtil
259
+ * @dbxUtilCategory string
260
+ * @dbxUtilKind factory
261
+ * @dbxUtilTags string, number, decode, normalize, factory
262
+ * @dbxUtilRelated number-string-dencoder-function, number-string-dencoder-encoded-string-value-function
263
+ *
230
264
  * @param dencoder - the NumberStringDencoder to use for decoding
231
265
  * @returns a function that normalizes input to a decoded number
266
+ * @__NO_SIDE_EFFECTS__
232
267
  */
233
268
  export declare function numberStringDencoderDecodedNumberValueFunction(dencoder: NumberStringDencoder): (input: NumberStringDencoderString | NumberStringDencoderNumber) => NumberStringDencoderNumber;
@@ -12,9 +12,16 @@ export type ToStringFunction<T, K extends string = string> = FactoryWithRequired
12
12
  /**
13
13
  * Wraps an existing factory with a {@link ToStringFunction} to produce strings from the factory's output.
14
14
  *
15
+ * @dbxUtil
16
+ * @dbxUtilCategory string
17
+ * @dbxUtilKind factory
18
+ * @dbxUtilTags string, factory, wrap, transform, to-string
19
+ * @dbxUtilRelated string-from-date-factory, string-from-time-factory
20
+ *
15
21
  * @param factory - the original value factory
16
22
  * @param toStringFunction - function to convert the factory's output to a string
17
23
  * @returns a new factory that produces string values
24
+ * @__NO_SIDE_EFFECTS__
18
25
  */
19
26
  export declare function stringFactoryFromFactory<T, K extends string = string>(factory: Factory<T>, toStringFunction: ToStringFunction<T, K>): StringFactory<K>;
20
27
  /**
@@ -42,15 +49,29 @@ export interface StringFromDateConfig {
42
49
  }
43
50
  /**
44
51
  * Creates a factory that returns a string based on the input date.
45
-
52
+ *
53
+ * @dbxUtil
54
+ * @dbxUtilCategory string
55
+ * @dbxUtilKind factory
56
+ * @dbxUtilTags string, date, factory, transform, slice
57
+ * @dbxUtilRelated string-from-time-factory, string-factory-from-factory, transform-string-function
58
+ *
46
59
  * @param config Configuration for the factory.
47
60
  * @returns A factory that returns a string based on the input date.
61
+ * @__NO_SIDE_EFFECTS__
48
62
  */
49
63
  export declare function stringFromDateFactory(config: StringFromDateConfig): StringFromDateFactory;
50
64
  /**
51
65
  * Creates a factory that returns a string based on the Unix timestamp of the input date.
52
66
  *
67
+ * @dbxUtil
68
+ * @dbxUtilCategory string
69
+ * @dbxUtilKind factory
70
+ * @dbxUtilTags string, date, time, timestamp, factory, suffix
71
+ * @dbxUtilRelated string-from-date-factory
72
+ *
53
73
  * @param digitsFromEnd The number of digits to return from the end of the generated string. Defaults to 7.
54
74
  * @returns A StringFromDateFactory.
75
+ * @__NO_SIDE_EFFECTS__
55
76
  */
56
77
  export declare function stringFromTimeFactory(digitsFromEnd?: number): StringFromDateFactory;
@@ -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
  /**
@@ -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;
@@ -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
  /**
@@ -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 NonNever, type PickProperties, type StrictOmit, type UnionToIntersection, type Writable } from 'ts-essentials';
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> = NonNever<{
127
+ export type StringKeyProperties<T> = OmitNeverProperties<{
127
128
  [K in keyof T]: K extends string ? T[K] : never;
128
129
  }>;
129
130
  /**
@@ -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>;