@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.
Files changed (204) hide show
  1. package/eslint/index.cjs.js +10008 -394
  2. package/eslint/index.esm.js +9982 -392
  3. package/eslint/package.json +4 -4
  4. package/eslint/src/lib/comments.d.ts +14 -3
  5. package/eslint/src/lib/dbx-tag-families.d.ts +280 -0
  6. package/eslint/src/lib/index.d.ts +26 -3
  7. package/eslint/src/lib/jsdoc-parser.d.ts +116 -0
  8. package/eslint/src/lib/no-inline-string-empty-object-intersection.rule.d.ts +44 -0
  9. package/eslint/src/lib/no-inline-type-import.rule.d.ts +38 -0
  10. package/eslint/src/lib/no-sister-re-export.rule.d.ts +69 -0
  11. package/eslint/src/lib/plugin.d.ts +52 -1
  12. package/eslint/src/lib/prefer-canonical-jsdoc.rule.d.ts +68 -0
  13. package/eslint/src/lib/prefer-config-object.rule.d.ts +61 -0
  14. package/eslint/src/lib/prefer-maybe-type.rule.d.ts +72 -0
  15. package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +1 -1
  16. package/eslint/src/lib/prefer-suggested-string.rule.d.ts +51 -0
  17. package/eslint/src/lib/require-constant-naming.rule.d.ts +63 -0
  18. package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +46 -0
  19. package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +45 -0
  20. package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +42 -0
  21. package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +43 -0
  22. package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +46 -0
  23. package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +46 -0
  24. package/eslint/src/lib/require-dbx-model-firebase-index-companion-tags.rule.d.ts +44 -0
  25. package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +44 -0
  26. package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +43 -0
  27. package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +44 -0
  28. package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +74 -0
  29. package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +43 -0
  30. package/eslint/src/lib/require-default-prefix-naming.rule.d.ts +60 -0
  31. package/eslint/src/lib/require-deprecated-alias-placement.rule.d.ts +75 -0
  32. package/eslint/src/lib/require-exported-jsdoc-example.rule.d.ts +61 -0
  33. package/eslint/src/lib/require-no-side-effects.rule.d.ts +1 -1
  34. package/eslint/src/lib/require-readonly-config-params.rule.d.ts +57 -0
  35. package/eslint/src/lib/require-single-return.rule.d.ts +42 -0
  36. package/fetch/index.cjs.js +95 -80
  37. package/fetch/index.esm.js +95 -80
  38. package/fetch/package.json +2 -2
  39. package/fetch/src/lib/error.d.ts +2 -2
  40. package/fetch/src/lib/fetch.d.ts +15 -15
  41. package/fetch/src/lib/fetch.file.d.ts +5 -5
  42. package/fetch/src/lib/fetch.limit.d.ts +2 -2
  43. package/fetch/src/lib/fetch.page.d.ts +1 -1
  44. package/fetch/src/lib/fetch.page.iterate.d.ts +4 -4
  45. package/fetch/src/lib/fetch.type.d.ts +3 -2
  46. package/fetch/src/lib/fetch.url.d.ts +13 -13
  47. package/fetch/src/lib/json.d.ts +12 -12
  48. package/fetch/src/lib/timeout.d.ts +2 -2
  49. package/fetch/src/lib/url.d.ts +11 -11
  50. package/index.cjs.js +2592 -2329
  51. package/index.esm.js +2590 -2327
  52. package/package.json +1 -1
  53. package/src/lib/array/array.boolean.d.ts +20 -20
  54. package/src/lib/array/array.d.ts +73 -72
  55. package/src/lib/array/array.factory.d.ts +8 -5
  56. package/src/lib/array/array.filter.d.ts +23 -20
  57. package/src/lib/array/array.find.d.ts +9 -8
  58. package/src/lib/array/array.index.d.ts +15 -14
  59. package/src/lib/array/array.indexed.d.ts +22 -19
  60. package/src/lib/array/array.make.d.ts +3 -2
  61. package/src/lib/array/array.map.d.ts +5 -5
  62. package/src/lib/array/array.number.d.ts +27 -27
  63. package/src/lib/array/array.random.d.ts +11 -10
  64. package/src/lib/array/array.set.d.ts +14 -14
  65. package/src/lib/array/array.string.d.ts +31 -31
  66. package/src/lib/array/array.unique.d.ts +22 -20
  67. package/src/lib/array/array.value.d.ts +3 -2
  68. package/src/lib/assertion/assert.error.d.ts +8 -8
  69. package/src/lib/assertion/assertion.d.ts +5 -5
  70. package/src/lib/assertion/assertion.generic.d.ts +3 -3
  71. package/src/lib/assertion/assertion.number.d.ts +6 -6
  72. package/src/lib/auth/auth.role.claims.d.ts +12 -11
  73. package/src/lib/auth/auth.role.d.ts +3 -3
  74. package/src/lib/auth/pkce.d.ts +2 -2
  75. package/src/lib/boolean.d.ts +11 -11
  76. package/src/lib/cache/cache.memoize.d.ts +6 -6
  77. package/src/lib/contact/domain.d.ts +9 -9
  78. package/src/lib/contact/email.d.ts +11 -11
  79. package/src/lib/contact/phone.d.ts +12 -12
  80. package/src/lib/contact/random.d.ts +11 -9
  81. package/src/lib/date/date.d.ts +60 -59
  82. package/src/lib/date/date.time.d.ts +2 -2
  83. package/src/lib/date/date.unix.d.ts +8 -8
  84. package/src/lib/date/duration.d.ts +17 -17
  85. package/src/lib/date/expires.d.ts +29 -27
  86. package/src/lib/date/hour.d.ts +23 -23
  87. package/src/lib/date/minute.d.ts +6 -6
  88. package/src/lib/date/time.d.ts +10 -9
  89. package/src/lib/date/week.d.ts +32 -31
  90. package/src/lib/encryption/encryption.object.d.ts +3 -3
  91. package/src/lib/error/error.d.ts +13 -12
  92. package/src/lib/error/error.server.d.ts +4 -4
  93. package/src/lib/file/pdf.d.ts +4 -4
  94. package/src/lib/filter/filter.d.ts +3 -2
  95. package/src/lib/function/function.boolean.d.ts +4 -3
  96. package/src/lib/function/function.forward.d.ts +6 -4
  97. package/src/lib/getter/getter.d.ts +24 -19
  98. package/src/lib/getter/getter.map.d.ts +6 -5
  99. package/src/lib/getter/getter.util.d.ts +3 -2
  100. package/src/lib/grouping.d.ts +25 -24
  101. package/src/lib/hash.d.ts +11 -10
  102. package/src/lib/iterable/iterable.d.ts +39 -39
  103. package/src/lib/iterable/iterable.map.d.ts +3 -3
  104. package/src/lib/key.d.ts +16 -16
  105. package/src/lib/map/map.d.ts +12 -12
  106. package/src/lib/map/map.intersection.d.ts +3 -3
  107. package/src/lib/map/map.key.d.ts +16 -14
  108. package/src/lib/misc/host.d.ts +2 -2
  109. package/src/lib/model/id.batch.d.ts +4 -3
  110. package/src/lib/model/id.factory.d.ts +4 -3
  111. package/src/lib/model/model.conversion.d.ts +19 -14
  112. package/src/lib/model/model.conversion.field.d.ts +2 -2
  113. package/src/lib/model/model.copy.d.ts +5 -4
  114. package/src/lib/model/model.d.ts +48 -46
  115. package/src/lib/model/model.modify.d.ts +10 -8
  116. package/src/lib/nodejs/stream.d.ts +6 -5
  117. package/src/lib/number/bitwise.dencoder.d.ts +12 -12
  118. package/src/lib/number/bound.d.ts +16 -13
  119. package/src/lib/number/dollar.d.ts +6 -5
  120. package/src/lib/number/encoded.d.ts +7 -7
  121. package/src/lib/number/factory.d.ts +4 -3
  122. package/src/lib/number/number.d.ts +37 -37
  123. package/src/lib/number/random.d.ts +11 -10
  124. package/src/lib/number/round.d.ts +34 -30
  125. package/src/lib/number/sort.d.ts +3 -2
  126. package/src/lib/number/transform.d.ts +5 -4
  127. package/src/lib/object/object.array.d.ts +6 -6
  128. package/src/lib/object/object.array.delta.d.ts +3 -2
  129. package/src/lib/object/object.d.ts +12 -12
  130. package/src/lib/object/object.empty.d.ts +3 -3
  131. package/src/lib/object/object.equal.d.ts +11 -10
  132. package/src/lib/object/object.filter.pojo.d.ts +74 -74
  133. package/src/lib/object/object.filter.tuple.d.ts +26 -26
  134. package/src/lib/object/object.flatten.d.ts +4 -4
  135. package/src/lib/object/object.key.d.ts +6 -4
  136. package/src/lib/object/object.map.d.ts +15 -13
  137. package/src/lib/page/page.d.ts +5 -5
  138. package/src/lib/page/page.filter.d.ts +8 -8
  139. package/src/lib/path/path.d.ts +98 -88
  140. package/src/lib/promise/callback.d.ts +2 -2
  141. package/src/lib/promise/is.d.ts +6 -6
  142. package/src/lib/promise/poll.d.ts +9 -9
  143. package/src/lib/promise/promise.d.ts +33 -30
  144. package/src/lib/promise/promise.factory.d.ts +4 -3
  145. package/src/lib/promise/promise.loop.d.ts +11 -11
  146. package/src/lib/promise/promise.task.d.ts +6 -5
  147. package/src/lib/promise/promise.type.d.ts +3 -3
  148. package/src/lib/promise/use.d.ts +3 -3
  149. package/src/lib/relation/relation.d.ts +15 -15
  150. package/src/lib/service/handler.config.d.ts +20 -16
  151. package/src/lib/service/handler.d.ts +3 -2
  152. package/src/lib/service/typed.service.d.ts +2 -2
  153. package/src/lib/set/set.d.ts +62 -59
  154. package/src/lib/set/set.delta.d.ts +5 -4
  155. package/src/lib/set/set.hashset.d.ts +5 -5
  156. package/src/lib/set/set.selection.d.ts +5 -4
  157. package/src/lib/sort.d.ts +11 -11
  158. package/src/lib/storage/storage.d.ts +2 -1
  159. package/src/lib/storage/storage.error.d.ts +4 -4
  160. package/src/lib/storage/storage.memory.d.ts +7 -7
  161. package/src/lib/storage/storage.object.d.ts +5 -5
  162. package/src/lib/string/case.d.ts +6 -6
  163. package/src/lib/string/char.d.ts +30 -29
  164. package/src/lib/string/dencoder.d.ts +25 -20
  165. package/src/lib/string/factory.d.ts +11 -8
  166. package/src/lib/string/html.d.ts +19 -19
  167. package/src/lib/string/mimetype.d.ts +9 -8
  168. package/src/lib/string/prefix.d.ts +8 -8
  169. package/src/lib/string/replace.d.ts +45 -39
  170. package/src/lib/string/search.d.ts +5 -4
  171. package/src/lib/string/sort.d.ts +13 -4
  172. package/src/lib/string/string.d.ts +44 -43
  173. package/src/lib/string/transform.d.ts +32 -23
  174. package/src/lib/string/tree.d.ts +5 -4
  175. package/src/lib/string/url.d.ts +5 -4
  176. package/src/lib/tree/tree.array.d.ts +5 -4
  177. package/src/lib/tree/tree.expand.d.ts +6 -6
  178. package/src/lib/tree/tree.explore.d.ts +13 -10
  179. package/src/lib/tree/tree.flatten.d.ts +10 -10
  180. package/src/lib/type.d.ts +42 -12
  181. package/src/lib/value/address.d.ts +7 -7
  182. package/src/lib/value/bound.d.ts +70 -66
  183. package/src/lib/value/build.d.ts +6 -6
  184. package/src/lib/value/comparator.d.ts +19 -17
  185. package/src/lib/value/cron.d.ts +2 -2
  186. package/src/lib/value/decision.d.ts +6 -5
  187. package/src/lib/value/equal.d.ts +11 -9
  188. package/src/lib/value/indexed.d.ts +101 -85
  189. package/src/lib/value/label.d.ts +2 -2
  190. package/src/lib/value/map.d.ts +20 -16
  191. package/src/lib/value/maybe.d.ts +36 -36
  192. package/src/lib/value/modifier.d.ts +24 -23
  193. package/src/lib/value/point.d.ts +85 -77
  194. package/src/lib/value/url.d.ts +2 -2
  195. package/src/lib/value/use.d.ts +36 -33
  196. package/src/lib/value/vector.d.ts +15 -14
  197. package/test/index.cjs.js +41 -36
  198. package/test/index.esm.js +41 -36
  199. package/test/package.json +2 -2
  200. package/test/src/lib/jest/jest.fail.d.ts +2 -2
  201. package/test/src/lib/shared/shared.d.ts +20 -20
  202. package/test/src/lib/shared/shared.fail.d.ts +21 -16
  203. package/test/src/lib/shared/shared.function.d.ts +4 -4
  204. package/test/src/lib/shared/shared.wrap.d.ts +10 -10
@@ -3,39 +3,42 @@ import { type Maybe } from '../value/maybe.type';
3
3
  /**
4
4
  * Trims leading and trailing whitespace from a string.
5
5
  *
6
+ * @param input - The string to trim.
7
+ * @returns The trimmed string.
8
+ *
6
9
  * @dbxUtil
7
10
  * @dbxUtilCategory string
8
11
  * @dbxUtilTags string, trim, whitespace, transform
9
12
  * @dbxUtilRelated transform-string-function
10
13
  *
11
- * @param input The string to trim.
12
- * @returns The trimmed string.
13
14
  * @__NO_SIDE_EFFECTS__
14
15
  */
15
16
  export declare function stringTrimFunction(input: string): string;
16
17
  /**
17
18
  * Converts a string to uppercase.
18
19
  *
20
+ * @param input - The string to convert.
21
+ * @returns The uppercase string.
22
+ *
19
23
  * @dbxUtil
20
24
  * @dbxUtilCategory string
21
25
  * @dbxUtilTags string, uppercase, case, transform
22
26
  * @dbxUtilRelated string-to-lowercase-function, transform-string-function
23
27
  *
24
- * @param input The string to convert.
25
- * @returns The uppercase string.
26
28
  * @__NO_SIDE_EFFECTS__
27
29
  */
28
30
  export declare function stringToUppercaseFunction(input: string): string;
29
31
  /**
30
32
  * Converts a string to lowercase.
31
33
  *
34
+ * @param input - The string to convert.
35
+ * @returns The lowercase string.
36
+ *
32
37
  * @dbxUtil
33
38
  * @dbxUtilCategory string
34
39
  * @dbxUtilTags string, lowercase, case, transform
35
40
  * @dbxUtilRelated string-to-uppercase-function, transform-string-function
36
41
  *
37
- * @param input The string to convert.
38
- * @returns The lowercase string.
39
42
  * @__NO_SIDE_EFFECTS__
40
43
  */
41
44
  export declare function stringToLowercaseFunction(input: string): string;
@@ -83,7 +86,7 @@ export interface TransformStringFunctionConfigRef<S extends string = string> {
83
86
  readonly transform: TransformStringFunctionConfig<S>;
84
87
  }
85
88
  /**
86
- * A function that maps a string of type S to another string of type S.
89
+ * Maps a string of type S to another string of type S.
87
90
  *
88
91
  * @template S The specific string type, defaults to `string`.
89
92
  */
@@ -100,9 +103,10 @@ export type TransformStringFunctionConfigInput<S extends string = string> = Tran
100
103
  * If the input is a function, it's wrapped into a config object with that function as the `transform` property.
101
104
  * If the input is undefined, it returns undefined.
102
105
  *
103
- * @template S The specific string type, defaults to `string`.
104
- * @param config The configuration input to normalize.
106
+ * @param config - The configuration input to normalize.
105
107
  * @returns A `TransformStringFunctionConfig` object, or `undefined` if the input config is undefined.
108
+ *
109
+ * @template S The specific string type, defaults to `string`.
106
110
  */
107
111
  export declare function transformStringFunctionConfig<S extends string = string>(config?: TransformStringFunctionConfigInput<S>): Maybe<TransformStringFunctionConfig<S>>;
108
112
  /**
@@ -115,15 +119,16 @@ export declare function transformStringFunctionConfig<S extends string = string>
115
119
  * 4. Lowercase conversion (if `config.toLowercase` is true and no `config.transform` or `config.toUppercase`).
116
120
  * If no transformations are specified, the identity function is returned.
117
121
  *
122
+ * @param config - The `TransformStringFunctionConfig` detailing the transformations.
123
+ * @returns A `TransformStringFunction` that applies the configured transformations.
124
+ *
118
125
  * @dbxUtil
119
126
  * @dbxUtilCategory string
120
127
  * @dbxUtilKind factory
121
128
  * @dbxUtilTags string, transform, trim, case, slice, factory
122
129
  * @dbxUtilRelated string-trim-function, string-to-uppercase-function, string-to-lowercase-function, slice-string-function
123
- *
124
130
  * @template S The specific string type, defaults to `string`.
125
- * @param config The `TransformStringFunctionConfig` detailing the transformations.
126
- * @returns A `TransformStringFunction` that applies the configured transformations.
131
+ *
127
132
  * @__NO_SIDE_EFFECTS__
128
133
  */
129
134
  export declare function transformStringFunction<S extends string = string>(config: TransformStringFunctionConfig<S>): TransformStringFunction<S>;
@@ -142,14 +147,15 @@ export type AddPrefixFunction = (input: string) => string;
142
147
  /**
143
148
  * Creates a function that adds a configured prefix to the input string if it does not exist on that string.
144
149
  *
150
+ * @param prefix - The prefix to add.
151
+ * @returns Adds the prefix to a string.
152
+ *
145
153
  * @dbxUtil
146
154
  * @dbxUtilCategory string
147
155
  * @dbxUtilKind factory
148
156
  * @dbxUtilTags string, prefix, add, factory
149
157
  * @dbxUtilRelated add-prefix, add-suffix-function
150
158
  *
151
- * @param prefix The prefix to add.
152
- * @returns A function that adds the prefix to a string.
153
159
  * @__NO_SIDE_EFFECTS__
154
160
  */
155
161
  export declare function addPrefixFunction(prefix: string): AddPrefixFunction;
@@ -160,22 +166,23 @@ export type AddSuffixFunction = TransformStringFunction;
160
166
  /**
161
167
  * Adds a suffix to a string if it does not already end with that suffix.
162
168
  *
163
- * @param suffix The suffix to add.
164
- * @param input The string to modify.
169
+ * @param suffix - The suffix to add.
170
+ * @param input - The string to modify.
165
171
  * @returns The modified string.
166
172
  */
167
173
  export declare function addSuffix(suffix: string, input: string): string;
168
174
  /**
169
175
  * Creates a function that adds a configured suffix to the input string if it does not exist on that string.
170
176
  *
177
+ * @param suffix - The suffix to add.
178
+ * @returns Adds the suffix to a string.
179
+ *
171
180
  * @dbxUtil
172
181
  * @dbxUtilCategory string
173
182
  * @dbxUtilKind factory
174
183
  * @dbxUtilTags string, suffix, add, factory
175
184
  * @dbxUtilRelated add-suffix, add-prefix-function
176
185
  *
177
- * @param suffix The suffix to add.
178
- * @returns A function that adds the suffix to a string.
179
186
  * @__NO_SIDE_EFFECTS__
180
187
  */
181
188
  export declare function addSuffixFunction(suffix: string): AddSuffixFunction;
@@ -186,15 +193,16 @@ export type PadStartFunction = TransformStringFunction;
186
193
  /**
187
194
  * Pads the start of a string to a minimum length.
188
195
  *
196
+ * @param minLength - The minimum length of the string.
197
+ * @param padCharacter - The character to use for padding.
198
+ * @returns Pads the start of a string.
199
+ *
189
200
  * @dbxUtil
190
201
  * @dbxUtilCategory string
191
202
  * @dbxUtilKind factory
192
203
  * @dbxUtilTags string, pad, start, factory, minimum-length
193
204
  * @dbxUtilRelated transform-string-function
194
205
  *
195
- * @param minLength The minimum length of the string.
196
- * @param padCharacter The character to use for padding.
197
- * @returns A function that pads the start of a string.
198
206
  * @__NO_SIDE_EFFECTS__
199
207
  */
200
208
  export declare function padStartFunction(minLength: number, padCharacter: string): PadStartFunction;
@@ -228,14 +236,15 @@ export interface SliceStringFunctionConfig {
228
236
  /**
229
237
  * Creates a function that slices and concats parts of a string based on the configuration.
230
238
  *
239
+ * @param config - The configuration for the slice function.
240
+ * @returns A SliceStringFunction.
241
+ *
231
242
  * @dbxUtil
232
243
  * @dbxUtilCategory string
233
244
  * @dbxUtilKind factory
234
245
  * @dbxUtilTags string, slice, take, factory, from-start, from-end
235
246
  * @dbxUtilRelated transform-string-function
236
247
  *
237
- * @param config The configuration for the slice function.
238
- * @returns A SliceStringFunction.
239
248
  * @__NO_SIDE_EFFECTS__
240
249
  */
241
250
  export declare function sliceStringFunction(config: SliceStringFunctionConfig): SliceStringFunction;
@@ -91,14 +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
+ * @param config - Configuration specifying the separator and optional metadata merge strategy.
95
+ * @returns A factory function that creates or extends split string trees.
96
+ *
94
97
  * @dbxUtil
95
98
  * @dbxUtilCategory string
96
99
  * @dbxUtilKind factory
97
100
  * @dbxUtilTags string, tree, split, separator, factory, hierarchy
98
101
  * @dbxUtilRelated add-to-split-string-tree, find-best-split-string-tree-match
99
102
  *
100
- * @param config - Configuration specifying the separator and optional metadata merge strategy.
101
- * @returns A factory function that creates or extends split string trees.
102
103
  * @__NO_SIDE_EFFECTS__
103
104
  */
104
105
  export declare function splitStringTreeFactory<M = unknown>(config: SplitStringTreeFactoryConfig<M>): SplitStringTreeFactory<M>;
@@ -202,7 +203,7 @@ export declare function findBestSplitStringTreeChildMatch<M = unknown>(tree: Spl
202
203
  *
203
204
  * @param tree - The tree to search.
204
205
  * @param value - The string value to find a match path for.
205
- * @returns An array of tree nodes forming the match path from root to deepest match, or `undefined` if no match is found.
206
+ * @returns The tree nodes forming the match path from root to deepest match, or `undefined` if no match is found.
206
207
  */
207
208
  export declare function findBestSplitStringTreeMatchPath<M = unknown>(tree: SplitStringTree<M>, value: SplitStringTreeNodeString): Maybe<SplitStringTree<M>[]>;
208
209
  /**
@@ -212,6 +213,6 @@ export declare function findBestSplitStringTreeMatchPath<M = unknown>(tree: Spli
212
213
  *
213
214
  * @param tree - The tree to search.
214
215
  * @param value - The string value to find a match path for.
215
- * @returns An array of child tree nodes forming the match path, or `undefined` if no match is found.
216
+ * @returns The child tree nodes forming the match path, or `undefined` if no match is found.
216
217
  */
217
218
  export declare function findBestSplitStringTreeChildMatchPath<M = unknown>(tree: SplitStringTree<M>, value: SplitStringTreeNodeString): Maybe<SplitStringTree<M>[]>;
@@ -198,7 +198,7 @@ export interface WebsiteUrlDetails {
198
198
  /**
199
199
  * The port number, or `undefined` if none is present.
200
200
  */
201
- readonly portNumber: PortNumber | undefined;
201
+ readonly portNumber: Maybe<PortNumber>;
202
202
  /**
203
203
  * The domain and path split pair.
204
204
  */
@@ -218,7 +218,7 @@ export interface WebsiteUrlDetails {
218
218
  /**
219
219
  * The query string portion, or undefined if none.
220
220
  */
221
- readonly query: string | undefined;
221
+ readonly query: Maybe<string>;
222
222
  }
223
223
  /**
224
224
  * Parses the input string as a website URL and returns detailed information about its components.
@@ -340,14 +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
+ * @param config - Configuration for path isolation, including base path removal, component range, query handling, and trailing slash behavior.
344
+ * @returns Isolates the configured portion of a website path.
345
+ *
343
346
  * @dbxUtil
344
347
  * @dbxUtilCategory string
345
348
  * @dbxUtilKind factory
346
349
  * @dbxUtilTags string, url, path, isolate, transform, factory, query
347
350
  * @dbxUtilRelated website-path-from-website-url, website-path-and-query-pair, fix-extra-query-parameters
348
351
  *
349
- * @param config - Configuration for path isolation, including base path removal, component range, query handling, and trailing slash behavior.
350
- * @returns A function that isolates the configured portion of a website path.
351
352
  * @__NO_SIDE_EFFECTS__
352
353
  */
353
354
  export declare function isolateWebsitePathFunction(config?: IsolateWebsitePathFunctionConfig): IsolateWebsitePathFunction;
@@ -16,18 +16,19 @@ export type ExpandFlattenTreeFunction<T, V> = (values: T[]) => V[];
16
16
  * This higher-order function takes a function to expand an array of values `T` into a list of trees (`N[]` where `N` is a TreeNode)
17
17
  * and another function to flatten these trees into a single array of values `V`.
18
18
  *
19
+ * @param expand - An ExpandTreeFunction (values: T[]) => N[] that converts an array of T into an array of tree nodes N.
20
+ * @param flatten - A FlattenTreeFunction (tree: N, array?: V[]) => V[] that flattens a tree of N nodes into an array of V values.
21
+ * @returns An ExpandFlattenTreeFunction (values: T[]) => V[] that performs the combined expansion and flattening.
22
+ *
19
23
  * @dbxUtil
20
24
  * @dbxUtilCategory tree
21
25
  * @dbxUtilKind factory
22
26
  * @dbxUtilTags tree, expand, flatten, compose, factory, transform
23
27
  * @dbxUtilRelated expand-tree-function, flatten-tree-to-array-function, expand-trees
24
- *
25
28
  * @template T The type of the initial input values.
26
29
  * @template V The type of the values in the final flattened output array.
27
30
  * @template N The type of the intermediate tree nodes. Must extend TreeNode with value T and children of type N.
28
- * @param expand An ExpandTreeFunction (values: T[]) => N[] that converts an array of T into an array of tree nodes N.
29
- * @param flatten A FlattenTreeFunction (tree: N, array?: V[]) => V[] that flattens a tree of N nodes into an array of V values.
30
- * @returns An ExpandFlattenTreeFunction (values: T[]) => V[] that performs the combined expansion and flattening.
31
+ *
31
32
  * @__NO_SIDE_EFFECTS__
32
33
  */
33
34
  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>;
@@ -12,7 +12,7 @@ export interface ExpandTree<T> {
12
12
  *
13
13
  * @param value The current value of type T to retrieve children for.
14
14
  * @param depth The depth of the current node.
15
- * @returns An array of child values of type T, or undefined/null if no children exist.
15
+ * @returns The child values of type T, or undefined/null if no children exist.
16
16
  */
17
17
  getChildren(value: T, depth: number): Maybe<T[]>;
18
18
  }
@@ -34,7 +34,7 @@ export interface ExpandTreeWithNodeBuilder<T, N extends TreeNode<T, N>> extends
34
34
  makeNode: (node: TreeNodeWithoutChildren<T, N>) => Omit<N, 'children'>;
35
35
  }
36
36
  /**
37
- * A function that expands an input value of type T into a TreeNode of type N.
37
+ * Expands an input value of type T into a TreeNode of type N.
38
38
  *
39
39
  * @template T The type of the input value to expand.
40
40
  * @template N The type of the TreeNode to be created. Defaults to TreeNode<T, any>.
@@ -65,15 +65,15 @@ export declare function expandTreeFunction<T, N extends TreeNode<T, N>>(config:
65
65
  * Convenience function for expanding multiple root values into an array of trees.
66
66
  * Each value in the input array is treated as a root for a new tree.
67
67
  *
68
+ * @param values - The root values of type T to expand.
69
+ * @param expandFn - An ExpandTreeFunction<T, N> used to expand each value into a tree.
70
+ * @returns Array of N, where each N is the root node of an expanded tree.
71
+ *
68
72
  * @dbxUtil
69
73
  * @dbxUtilCategory tree
70
74
  * @dbxUtilTags tree, expand, multiple, roots, hierarchy, build, batch
71
75
  * @dbxUtilRelated expand-tree-function, expand-flatten-tree-function
72
- *
73
76
  * @template T The type of the input values.
74
77
  * @template N The type of the TreeNode in the resulting trees. Must extend TreeNode<T, N>.
75
- * @param values An array of root values of type T to expand.
76
- * @param expandFn An ExpandTreeFunction<T, N> used to expand each value into a tree.
77
- * @returns An array of N, where each N is the root node of an expanded tree.
78
78
  */
79
79
  export declare function expandTrees<T, N extends TreeNode<T, N>>(values: T[], expandFn: ExpandTreeFunction<T, N>): N[];
@@ -73,16 +73,16 @@ export interface ExploreTreeFunctionConfig<N extends TreeNode<unknown>, V = N> {
73
73
  /**
74
74
  * Custom traversal strategy (e.g., breadth-first). Defaults to depth-first.
75
75
  */
76
- traverseFunctionFactory?: ExploreTreeTraversalFactoryFunction<N, V>;
76
+ readonly traverseFunctionFactory?: ExploreTreeTraversalFactoryFunction<N, V>;
77
77
  /**
78
78
  * Transforms each node into a value before visiting. Defaults to identity.
79
79
  */
80
- mapNodeFunction?: (node: N) => V;
80
+ readonly mapNodeFunction?: (node: N) => V;
81
81
  /**
82
82
  * Controls whether each node is visited, skipped, or has only its children visited.
83
83
  * Defaults to visiting all nodes.
84
84
  */
85
- shouldVisitNodeFunction?: Maybe<ExploreTreeVisitNodeDecisionFunction<N, V>>;
85
+ readonly shouldVisitNodeFunction?: Maybe<ExploreTreeVisitNodeDecisionFunction<N, V>>;
86
86
  }
87
87
  /**
88
88
  * Traverses one or more trees, invoking a visit callback on each node.
@@ -100,15 +100,15 @@ export type ExploreTreeFunction<N extends TreeNode<unknown, N>, V> = (trees: Arr
100
100
  * By default uses depth-first traversal, identity mapping, and visits all nodes. All options
101
101
  * can be overridden per-call.
102
102
  *
103
+ * @param config - Optional default configuration for mapping, filtering, and traversal strategy.
104
+ * @returns A reusable function that explores trees with the configured behavior.
105
+ *
103
106
  * @dbxUtil
104
107
  * @dbxUtilCategory tree
105
108
  * @dbxUtilKind factory
106
109
  * @dbxUtilTags tree, explore, traverse, visit, factory, depth-first, breadth-first, walk
107
110
  * @dbxUtilRelated depth-first-explore-tree-traversal-factory-function, breadth-first-explore-tree-traversal-factory-function, flatten-tree-to-array-function
108
111
  *
109
- * @param config - Optional default configuration for mapping, filtering, and traversal strategy.
110
- * @returns A reusable function that explores trees with the configured behavior.
111
- *
112
112
  * @example
113
113
  * ```typescript
114
114
  * const exploreFn = exploreTreeFunction<TestNode, string>({
@@ -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
+ *
123
124
  * @__NO_SIDE_EFFECTS__
124
125
  */
125
126
  export declare function exploreTreeFunction<N extends TreeNode<unknown, N>, V>(config?: Maybe<ExploreTreeFunctionConfig<N, V>>): ExploreTreeFunction<N, V>;
@@ -129,14 +130,14 @@ export declare function exploreTreeFunction<N extends TreeNode<unknown, N>, V>(c
129
130
  * Visits each node before its children (pre-order). This is the default traversal
130
131
  * strategy used by {@link exploreTreeFunction}.
131
132
  *
133
+ * @returns A traversal factory that processes nodes in depth-first order.
134
+ *
132
135
  * @dbxUtil
133
136
  * @dbxUtilCategory tree
134
137
  * @dbxUtilKind factory
135
138
  * @dbxUtilTags tree, traverse, depth-first, dfs, pre-order, factory, strategy
136
139
  * @dbxUtilRelated breadth-first-explore-tree-traversal-factory-function, explore-tree-function
137
140
  *
138
- * @returns A traversal factory that processes nodes in depth-first order.
139
- *
140
141
  * @example
141
142
  * ```typescript
142
143
  * const exploreFn = exploreTreeFunction<TestNode, TestNode>({
@@ -144,6 +145,7 @@ export declare function exploreTreeFunction<N extends TreeNode<unknown, N>, V>(c
144
145
  * });
145
146
  * // Visits: root -> child1 -> leaf1 -> leaf2 -> child2 -> leaf3
146
147
  * ```
148
+ *
147
149
  * @__NO_SIDE_EFFECTS__
148
150
  */
149
151
  export declare function depthFirstExploreTreeTraversalFactoryFunction<N extends TreeNode<unknown, N>, V>(): ExploreTreeTraversalFactoryFunction<N, V>;
@@ -153,14 +155,14 @@ export declare function depthFirstExploreTreeTraversalFactoryFunction<N extends
153
155
  * Visits nodes level by level, processing all nodes at depth N before moving to depth N+1.
154
156
  * Uses an internal queue to defer child processing until the current level is complete.
155
157
  *
158
+ * @returns A traversal factory that processes nodes in breadth-first order.
159
+ *
156
160
  * @dbxUtil
157
161
  * @dbxUtilCategory tree
158
162
  * @dbxUtilKind factory
159
163
  * @dbxUtilTags tree, traverse, breadth-first, bfs, level-order, factory, strategy, queue
160
164
  * @dbxUtilRelated depth-first-explore-tree-traversal-factory-function, explore-tree-function
161
165
  *
162
- * @returns A traversal factory that processes nodes in breadth-first order.
163
- *
164
166
  * @example
165
167
  * ```typescript
166
168
  * const exploreFn = exploreTreeFunction<TestNode, TestNode>({
@@ -168,6 +170,7 @@ export declare function depthFirstExploreTreeTraversalFactoryFunction<N extends
168
170
  * });
169
171
  * // Visits: root -> child1, child2, child3 -> leaf1, leaf2, leaf3
170
172
  * ```
173
+ *
171
174
  * @__NO_SIDE_EFFECTS__
172
175
  */
173
176
  export declare function breadthFirstExploreTreeTraversalFactoryFunction<N extends TreeNode<unknown, N>, V>(): ExploreTreeTraversalFactoryFunction<N, V>;
@@ -3,7 +3,7 @@ import { type Maybe } from '../value/maybe.type';
3
3
  import { type TreeNode } from './tree';
4
4
  import { type ExploreTreeFunctionConfig, ExploreTreeVisitNodeDecision, type ExploreTreeVisitNodeDecisionFunction } from './tree.explore';
5
5
  /**
6
- * A function that flattens a tree structure into an array of values.
6
+ * Flattens a tree structure into an array of values.
7
7
  *
8
8
  * @template N The type of the tree node, extending TreeNode.
9
9
  * @template V The type of values in the resulting flattened array.
@@ -54,15 +54,15 @@ export type FlattenTreeAddNodeDecisionFunction<N extends TreeNode<unknown>, V =
54
54
  /**
55
55
  * Flattens a tree into an array containing all its nodes using depth-first traversal.
56
56
  *
57
+ * @param tree - The root node to flatten.
58
+ * @param addNodeFn - Optional filter controlling which nodes and subtrees are included.
59
+ * @returns The all nodes in the tree that pass the filter.
60
+ *
57
61
  * @dbxUtil
58
62
  * @dbxUtilCategory tree
59
63
  * @dbxUtilTags tree, flatten, traverse, depth-first, collect, nodes, array
60
64
  * @dbxUtilRelated flatten-tree-to-array, flatten-tree-to-array-function, explore-tree-function
61
65
  *
62
- * @param tree - The root node to flatten.
63
- * @param addNodeFn - Optional filter controlling which nodes and subtrees are included.
64
- * @returns An array of all nodes in the tree that pass the filter.
65
- *
66
66
  * @example
67
67
  * ```typescript
68
68
  * const nodes = flattenTree(rootNode);
@@ -75,16 +75,16 @@ export declare function flattenTree<N extends TreeNode<unknown> = TreeNode<unkno
75
75
  *
76
76
  * Useful for accumulating nodes from multiple trees into a single collection.
77
77
  *
78
- * @dbxUtil
79
- * @dbxUtilCategory tree
80
- * @dbxUtilTags tree, flatten, append, accumulate, collect, mutate, array
81
- * @dbxUtilRelated flatten-tree, flatten-tree-to-array-function
82
- *
83
78
  * @param tree - The root node to flatten.
84
79
  * @param array - The target array to push flattened nodes into.
85
80
  * @param addNodeFn - Optional filter controlling which nodes and subtrees are included.
86
81
  * @returns The same array reference, now containing the appended nodes.
87
82
  *
83
+ * @dbxUtil
84
+ * @dbxUtilCategory tree
85
+ * @dbxUtilTags tree, flatten, append, accumulate, collect, mutate, array
86
+ * @dbxUtilRelated flatten-tree, flatten-tree-to-array-function
87
+ *
88
88
  * @example
89
89
  * ```typescript
90
90
  * const existing: TreeNode[] = [someNode];
package/src/lib/type.d.ts CHANGED
@@ -4,6 +4,35 @@ import { type Maybe } from './value/maybe.type';
4
4
  * Boolean, string or number value.
5
5
  */
6
6
  export type PrimativeValue = boolean | string | number;
7
+ /**
8
+ * Open-ended union of known string literals `T` plus an arbitrary string fallback.
9
+ *
10
+ * `T | string` collapses to `string` in TypeScript and erases IDE autocomplete for the
11
+ * literal members. The `(string & {})` intersection is the canonical workaround: at
12
+ * runtime it is just `string`, but the compiler keeps the literal members visible in
13
+ * the union so editors still suggest them.
14
+ *
15
+ * Always prefer this named alias over writing the intersection inline. Two lint rules
16
+ * enforce that:
17
+ *
18
+ * - `dereekb-util/no-inline-string-empty-object-intersection` (error) — flags every
19
+ * inline `T | (string & {})` and tells the developer to switch to `SuggestedString<T>`.
20
+ * - `dereekb-util/prefer-suggested-string` (warn) — flags `T | string` where `T` is a
21
+ * literal-string union; if you actually want autocomplete-preserving behavior, switch
22
+ * to `SuggestedString<T>`, otherwise drop the literal half and keep plain `string`.
23
+ *
24
+ * Reach for `SuggestedString` only when the API genuinely accepts unknown string values
25
+ * alongside a known set (e.g. third-party APIs that document a literal set but allow
26
+ * custom strings). For closed sets, use a plain literal union; for unconstrained input,
27
+ * use plain `string`.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * type ZohoDeskTicketPriority = SuggestedString<'Low' | 'Medium' | 'High' | 'Urgent'>;
32
+ * // accepts any string, but autocompletes the four known priorities.
33
+ * ```
34
+ */
35
+ export type SuggestedString<T extends string> = T | (string & Record<never, never>);
7
36
  /**
8
37
  * Class typing, restricted to types that have a constructor via the new keyword.
9
38
  */
@@ -17,26 +46,26 @@ export type ObjectWithConstructor = {
17
46
  * Returns true if the input is a function-like value with a prototype and constructor (i.e., a class or named function declaration).
18
47
  * Returns false for arrow functions, class instances, plain objects, and primitives.
19
48
  *
49
+ * @param obj - The value to check.
50
+ * @returns Whether the value is a function with a constructor.
51
+ *
20
52
  * @dbxUtil
21
53
  * @dbxUtilCategory type
22
54
  * @dbxUtilTags type, type-guard, function, class, constructor, reflection
23
55
  * @dbxUtilRelated is-class-like-type, get-function-type, is-non-class-function
24
- *
25
- * @param obj - The value to check.
26
- * @returns Whether the value is a function with a constructor.
27
56
  */
28
57
  export declare function isObjectWithConstructor(obj: any): obj is ObjectWithConstructor;
29
58
  /**
30
59
  * Returns true if the input is a class (requires `new` to instantiate). Distinguishes classes from regular functions
31
60
  * by checking that the prototype is non-writable.
32
61
  *
62
+ * @param obj - The value to check.
63
+ * @returns Whether the value is a class type.
64
+ *
33
65
  * @dbxUtil
34
66
  * @dbxUtilCategory type
35
67
  * @dbxUtilTags type, type-guard, class, reflection, instance
36
68
  * @dbxUtilRelated is-object-with-constructor, get-function-type
37
- *
38
- * @param obj - The value to check.
39
- * @returns Whether the value is a class type.
40
69
  */
41
70
  export declare function isClassLikeType(obj: unknown): obj is ClassLikeType;
42
71
  export type FunctionType = 'function' | 'class' | 'arrow';
@@ -44,25 +73,26 @@ export type FunctionType = 'function' | 'class' | 'arrow';
44
73
  * Determines the function type of the input value: `'class'`, `'function'`, or `'arrow'`.
45
74
  * Returns `null` if the input is not a function.
46
75
  *
76
+ * @param x - The value to inspect.
77
+ * @returns The {@link FunctionType}, or `null` for non-functions.
78
+ *
47
79
  * @dbxUtil
48
80
  * @dbxUtilCategory type
49
81
  * @dbxUtilTags type, function, class, arrow, reflection, kind, detect
50
82
  * @dbxUtilRelated is-class-like-type, is-non-class-function, is-object-with-constructor
51
- *
52
- * @param x - The value to inspect.
53
- * @returns The {@link FunctionType}, or `null` for non-functions.
54
83
  */
55
84
  export declare function getFunctionType(x: unknown): Maybe<FunctionType>;
56
85
  /**
57
86
  * Returns true if the input is a function but not a class (i.e., a regular function or arrow function).
58
87
  *
88
+ * @param x - The value to check.
89
+ * @returns Whether the value is a non-class function.
90
+ *
59
91
  * @dbxUtil
60
92
  * @dbxUtilCategory type
61
93
  * @dbxUtilTags type, type-guard, function, arrow, reflection, callable
62
94
  * @dbxUtilRelated is-class-like-type, get-function-type
63
95
  *
64
- * @param x - The value to check.
65
- * @returns Whether the value is a non-class function.
66
96
  * @__NO_SIDE_EFFECTS__
67
97
  */
68
98
  export declare function isNonClassFunction(x: unknown): x is Function;
@@ -87,7 +117,7 @@ export type ValuesTypesAsArray<T> = T[keyof T][];
87
117
  * Converts the input value to a string, if possible. Never otherwise.
88
118
  */
89
119
  export type KeyAsString<K> = `${KeyCanBeString<K>}`;
90
- export type KeyCanBeString<K> = K extends number | boolean | string | null | undefined ? K : never;
120
+ export type KeyCanBeString<K> = K extends Maybe<number | boolean | string> ? K : never;
91
121
  export type BooleanKeyValueTransformMap<T> = KeyValueTransformMap<T, boolean>;
92
122
  /**
93
123
  * Merges the types T and R, but replaces keys within T with those in R.
@@ -107,9 +107,9 @@ export interface UnitedStatesAddressWithContact extends UnitedStatesAddress {
107
107
  * Empty or undefined fields are omitted. If the input includes contact fields (name, phone), they appear at the top.
108
108
  * Returns `undefined` if no meaningful parts are present.
109
109
  *
110
- * @param input - the address to format
111
- * @param addLinebreaks - whether to join parts with newlines (default `true`) or concatenate them directly
112
- * @returns the formatted address string, or `undefined` if no meaningful parts are present
110
+ * @param input - The address to format.
111
+ * @param addLinebreaks - Whether to join parts with newlines (default `true`) or concatenate them directly.
112
+ * @returns The formatted address string, or `undefined` if no meaningful parts are present.
113
113
  */
114
114
  export declare function unitedStatesAddressString(input: Maybe<Partial<UnitedStatesAddress | UnitedStatesAddressWithContact>>, addLinebreaks?: boolean): Maybe<string>;
115
115
  /**
@@ -117,8 +117,8 @@ export declare function unitedStatesAddressString(input: Maybe<Partial<UnitedSta
117
117
  *
118
118
  * Useful for validating an address before submission or display.
119
119
  *
120
- * @param input - the address to validate
121
- * @returns `true` if all required fields (line1, city, state, zip) are populated
120
+ * @param input - The address to validate.
121
+ * @returns `true` if all required fields (line1, city, state, zip) are populated.
122
122
  *
123
123
  * @example
124
124
  * ```ts
@@ -145,8 +145,8 @@ export declare const US_STATE_CODE_STRING_REGEX: RegExp;
145
145
  *
146
146
  * Only matches uppercase codes; lowercase input returns `false`.
147
147
  *
148
- * @param input - the string to test
149
- * @returns `true` if the input matches a valid US state or territory code
148
+ * @param input - The string to test.
149
+ * @returns `true` if the input matches a valid US state or territory code.
150
150
  *
151
151
  * @example
152
152
  * ```ts