@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "13.11.14",
3
+ "version": "13.11.15",
4
4
  "sideEffects": false,
5
5
  "exports": {
6
6
  "./test": {
@@ -21,49 +21,49 @@ export type BooleanKeyArray<T = string> = Maybe<T[]>;
21
21
  /**
22
22
  * Wraps a key reading function to ensure that empty string keys are not used in boolean key arrays.
23
23
  *
24
- * @param readKey - The key reading function to wrap
25
- * @returns A wrapped key reading function that throws an error if an empty string is used as a key
24
+ * @param readKey - The key reading function to wrap.
25
+ * @returns A wrapped key reading function that throws an error if an empty string is used as a key.
26
26
  */
27
27
  export declare function readBooleanKeySafetyWrap<T>(readKey: ReadModelKeyFunction<T>): ReadModelKeyFunction<T>;
28
28
  /**
29
29
  * Checks if a boolean key array evaluates to false (empty or undefined).
30
30
  *
31
- * @param value - The boolean key array to check
32
- * @returns True if the array is empty or undefined, false otherwise
31
+ * @param value - Boolean-key array to evaluate as a tri-state.
32
+ * @returns True when the array has no entries (treated as `false`); otherwise false.
33
33
  */
34
34
  export declare function isFalseBooleanKeyArray(value: BooleanKeyArray): boolean;
35
35
  /**
36
36
  * Checks if a boolean key array evaluates to true (has at least one value).
37
37
  *
38
- * @param value - The boolean key array to check
39
- * @returns True if the array has at least one value, false otherwise
38
+ * @param value - Boolean-key array to evaluate as a tri-state.
39
+ * @returns True when at least one entry exists (treated as `true`); otherwise false.
40
40
  */
41
41
  export declare function isTrueBooleanKeyArray(value: BooleanKeyArray): boolean;
42
42
  /**
43
43
  * Inserts a value into a boolean key array, removing any existing values with the same key.
44
44
  *
45
- * @param array - The boolean key array to insert into
46
- * @param value - The value to insert
47
- * @param readKey - Function to extract the key from a value
48
- * @returns A new boolean key array with the value inserted
45
+ * @param array - Existing boolean-key array to extend.
46
+ * @param value - Entry to add, displacing any prior entry with the same key.
47
+ * @param readKey - Resolver that derives the comparison key from an entry.
48
+ * @returns Resulting boolean-key array containing the inserted entry.
49
49
  */
50
50
  export declare function insertIntoBooleanKeyArray<T>(array: BooleanKeyArray<T>, value: T, readKey: ReadModelKeyFunction<T>): BooleanKeyArray<T>;
51
51
  /**
52
52
  * Removes a value from a boolean key array based on its key.
53
53
  *
54
- * @param array - The boolean key array to remove from
55
- * @param value - The value to remove
56
- * @param readKey - Function to extract the key from a value
57
- * @returns A new boolean key array with the value removed
54
+ * @param array - Existing boolean-key array to filter.
55
+ * @param value - Entry whose key identifies the row to drop.
56
+ * @param readKey - Resolver that derives the comparison key from an entry.
57
+ * @returns Boolean-key array with entries matching the value's key removed.
58
58
  */
59
59
  export declare function removeFromBooleanKeyArray<T>(array: BooleanKeyArray<T>, value: T, readKey: ReadModelKeyFunction<T>): BooleanKeyArray<T>;
60
60
  /**
61
61
  * Removes values from a boolean key array that match the specified key.
62
62
  *
63
- * @param array - The boolean key array to remove from
64
- * @param key - The key to match for removal
65
- * @param readKey - Function to extract the key from a value
66
- * @returns A new boolean key array with matching values removed
63
+ * @param array - Existing boolean-key array to filter.
64
+ * @param key - Identifier whose entries should be removed.
65
+ * @param readKey - Resolver that derives the comparison key from an entry.
66
+ * @returns Boolean-key array with entries carrying the given key removed.
67
67
  */
68
68
  export declare function removeByKeyFromBooleanKeyArray<T>(array: BooleanKeyArray<T>, key: string, readKey: ReadModelKeyFunction<T>): BooleanKeyArray<T>;
69
69
  /**
@@ -73,8 +73,8 @@ export type BooleanKeyArrayUtility<T> = ReturnType<typeof booleanKeyArrayUtility
73
73
  /**
74
74
  * Creates a utility object with functions for working with boolean key arrays.
75
75
  *
76
- * @param readKey - Function to extract the key from a value
77
- * @returns An object with utility functions for boolean key arrays
76
+ * @param readKey - Function to extract the key from a value.
77
+ * @returns An object with utility functions for boolean key arrays.
78
78
  */
79
79
  export declare function booleanKeyArrayUtility<T>(readKey: ReadModelKeyFunction<T>): {
80
80
  isFalse: (value: BooleanKeyArray) => boolean;
@@ -11,25 +11,25 @@ export type ArrayOrValue<T> = T | T[];
11
11
  /**
12
12
  * Converts the input value to an array containing itself, or returns itself if it is a non-empty array. Returns undefined if the input is nullish or results in an empty array.
13
13
  *
14
+ * @param arrayOrValue - Single value or array to convert.
15
+ * @returns An array with at least one element, or undefined if the result would be empty.
16
+ *
14
17
  * @dbxUtil
15
18
  * @dbxUtilCategory array
16
19
  * @dbxUtilTags array, non-empty, convert, ensure, normalize
17
20
  * @dbxUtilRelated convert-maybe-to-array, convert-to-array
18
- *
19
- * @param arrayOrValue - single value or array to convert
20
- * @returns an array with at least one element, or undefined if the result would be empty
21
21
  */
22
22
  export declare function convertMaybeToNonEmptyArray<T>(arrayOrValue: Maybe<ArrayOrValue<T>>): Maybe<T[]>;
23
23
  /**
24
24
  * Converts the input value to an array containing itself, or returns itself if it is an array. Returns an empty array if the input is nullish.
25
25
  *
26
+ * @param arrayOrValue - Single value, array, or nullish value to convert.
27
+ * @returns The input wrapped in an array, the input array itself, or an empty array if nullish.
28
+ *
26
29
  * @dbxUtil
27
30
  * @dbxUtilCategory array
28
31
  * @dbxUtilTags array, convert, ensure, normalize, maybe, nullish
29
32
  * @dbxUtilRelated convert-maybe-to-non-empty-array, convert-to-array, as-array
30
- *
31
- * @param arrayOrValue - single value, array, or nullish value to convert
32
- * @returns the input wrapped in an array, the input array itself, or an empty array if nullish
33
33
  */
34
34
  export declare function convertMaybeToArray<T>(arrayOrValue: Maybe<ArrayOrValue<T>>): T[];
35
35
  /**
@@ -43,37 +43,37 @@ export declare const asNonEmptyArray: typeof convertMaybeToNonEmptyArray;
43
43
  /**
44
44
  * Converts the input value to an array containing itself, or returns itself if it is already an array.
45
45
  *
46
+ * @param arrayOrValue - Single value or array to convert.
47
+ * @returns The input array unchanged, or a new single-element array wrapping the input value.
48
+ *
46
49
  * @dbxUtil
47
50
  * @dbxUtilCategory array
48
51
  * @dbxUtilTags array, convert, ensure, wrap, normalize
49
52
  * @dbxUtilRelated convert-maybe-to-array, convert-maybe-to-non-empty-array
50
- *
51
- * @param arrayOrValue - single value or array to convert
52
- * @returns the input array unchanged, or a new single-element array wrapping the input value
53
53
  */
54
54
  export declare function convertToArray<T>(arrayOrValue: ArrayOrValue<T>): T[];
55
55
  /**
56
56
  * Returns the first value from the array, or the value itself if not an array.
57
57
  *
58
+ * @param input - Single value or array to retrieve from.
59
+ * @returns The first element of the array, or the input value itself.
60
+ *
58
61
  * @dbxUtil
59
62
  * @dbxUtilCategory array
60
63
  * @dbxUtilTags array, first, head, get, value
61
64
  * @dbxUtilRelated last-value, value-at-index, first-and-last-value
62
- *
63
- * @param input - single value or array to retrieve from
64
- * @returns the first element of the array, or the input value itself
65
65
  */
66
66
  export declare function firstValue<T>(input: ArrayOrValue<T>): T;
67
67
  /**
68
68
  * Returns the last value from the array, or the value itself if not an array.
69
69
  *
70
+ * @param input - Single value or array to retrieve from.
71
+ * @returns The last element of the array, or the input value itself.
72
+ *
70
73
  * @dbxUtil
71
74
  * @dbxUtilCategory array
72
75
  * @dbxUtilTags array, last, tail, get, value
73
76
  * @dbxUtilRelated first-value, value-at-index, first-and-last-value
74
- *
75
- * @param input - single value or array to retrieve from
76
- * @returns the last element of the array, or the input value itself
77
77
  */
78
78
  export declare function lastValue<T>(input: ArrayOrValue<T>): T;
79
79
  /**
@@ -81,106 +81,106 @@ export declare function lastValue<T>(input: ArrayOrValue<T>): T;
81
81
  *
82
82
  * If the input is not an array, returns that value as both the first and last value.
83
83
  *
84
+ * @param input - Single value or array to retrieve from.
85
+ * @returns A two-element tuple of the first and last values.
86
+ *
84
87
  * @dbxUtil
85
88
  * @dbxUtilCategory array
86
89
  * @dbxUtilTags array, first, last, head, tail, tuple, endpoints
87
90
  * @dbxUtilRelated first-value, last-value, value-at-index
88
- *
89
- * @param input - single value or array to retrieve from
90
- * @returns a two-element tuple of the first and last values
91
91
  */
92
92
  export declare function firstAndLastValue<T>(input: ArrayOrValue<T>): [T, T];
93
93
  /**
94
94
  * Returns the value at the given index from an array, or the value itself if not an array.
95
95
  *
96
+ * @param input - Single value or array to retrieve from.
97
+ * @param index - Zero-based index of the element to retrieve.
98
+ * @returns The element at the specified index, or the input value itself if not an array.
99
+ *
96
100
  * @dbxUtil
97
101
  * @dbxUtilCategory array
98
102
  * @dbxUtilTags array, index, get, value, at
99
103
  * @dbxUtilRelated first-value, last-value, first-and-last-value
100
- *
101
- * @param input - single value or array to retrieve from
102
- * @param index - zero-based index of the element to retrieve
103
- * @returns the element at the specified index, or the input value itself if not an array
104
104
  */
105
105
  export declare function valueAtIndex<T>(input: ArrayOrValue<T>, index: number): T;
106
106
  /**
107
107
  * Concatenates the input arrays into a single array, filtering out nullish entries.
108
108
  *
109
+ * @param arrays - Arrays to concatenate; nullish entries are ignored.
110
+ * @returns A single flattened array containing all elements from the non-nullish input arrays.
111
+ *
109
112
  * @dbxUtil
110
113
  * @dbxUtilCategory array
111
114
  * @dbxUtilTags array, concat, concatenate, combine, flatten, merge
112
115
  * @dbxUtilRelated flatten-array, merge-arrays
113
- *
114
- * @param arrays - arrays to concatenate; nullish entries are ignored
115
- * @returns a single flattened array containing all elements from the non-nullish input arrays
116
116
  */
117
117
  export declare function concatArrays<T>(...arrays: Maybe<T[]>[]): T[];
118
118
  /**
119
119
  * Flattens a two-dimensional array into a single-dimensional array. Any null/undefined entries in the outer dimension are filtered out.
120
120
  *
121
+ * @param array - Two-dimensional array to flatten, may contain nullish entries.
122
+ * @returns A single-dimensional array with all elements from the non-nullish inner arrays.
123
+ *
121
124
  * @dbxUtil
122
125
  * @dbxUtilCategory array
123
126
  * @dbxUtilTags array, flatten, flat, nested, two-dimensional, concat
124
127
  * @dbxUtilRelated concat-arrays, flatten-array-or-value-array, merge-arrays
125
- *
126
- * @param array - two-dimensional array to flatten, may contain nullish entries
127
- * @returns a single-dimensional array with all elements from the non-nullish inner arrays
128
128
  */
129
129
  export declare function flattenArray<T>(array: Maybe<T[]>[]): T[];
130
130
  /**
131
131
  * Flattens an array of {@link ArrayOrValue} entries into a single array. Nullish entries are filtered out.
132
132
  *
133
- * @param array - array of single values or arrays to flatten
134
- * @returns a single flat array containing all non-nullish elements
133
+ * @param array - Array of single values or arrays to flatten.
134
+ * @returns A single flat array containing all non-nullish elements.
135
135
  */
136
136
  export declare function flattenArrayOrValueArray<T>(array: ArrayOrValue<Maybe<T>>[]): T[];
137
137
  /**
138
138
  * Creates a shallow copy of the input array. Returns an empty array if the input is nullish.
139
139
  *
140
+ * @param input - Array to copy, or nullish.
141
+ * @returns A new array with the same elements, or an empty array if input is nullish.
142
+ *
140
143
  * @dbxUtil
141
144
  * @dbxUtilCategory array
142
145
  * @dbxUtilTags array, copy, clone, shallow, duplicate
143
146
  * @dbxUtilRelated convert-maybe-to-array
144
- *
145
- * @param input - array to copy, or nullish
146
- * @returns a new array with the same elements, or an empty array if input is nullish
147
147
  */
148
148
  export declare function copyArray<T>(input: Maybe<T[]>): T[];
149
149
  /**
150
150
  * Pushes the same element onto the target array a specified number of times.
151
151
  *
152
- * @param target - array to push elements into
153
- * @param element - element to push
154
- * @param times - number of times to push the element
155
- * @returns the mutated target array
152
+ * @param target - Array to push elements into.
153
+ * @param element - Element to push.
154
+ * @param times - Number of times to push the element.
155
+ * @returns The mutated target array.
156
156
  */
157
157
  export declare function pushElementOntoArray<T>(target: T[], element: T, times: number): T[];
158
158
  /**
159
159
  * Merges all input arrays into a single new array. Nullish entries are ignored.
160
160
  *
161
+ * @param arrays - Arrays to merge; nullish entries are skipped.
162
+ * @returns A new array containing all elements from the provided arrays.
163
+ *
161
164
  * @dbxUtil
162
165
  * @dbxUtilCategory array
163
166
  * @dbxUtilTags array, merge, concat, flatten, combine
164
167
  * @dbxUtilRelated merge-arrays-into-array
165
- *
166
- * @param arrays - arrays to merge; nullish entries are skipped
167
- * @returns a new array containing all elements from the provided arrays
168
168
  */
169
169
  export declare function mergeArrays<T>(arrays: Maybe<T[]>[]): T[];
170
170
  /**
171
171
  * Merges the input arrays into the target array by pushing each item from each array. Creates an empty array if the target is nullish.
172
172
  *
173
- * @param target - array to merge into; a new array is created if nullish
174
- * @param arrays - arrays whose elements are pushed into the target; nullish entries are skipped
175
- * @returns the mutated target array, or a new array if the target was nullish
173
+ * @param target - Array to merge into; a new array is created if nullish.
174
+ * @param arrays - Arrays whose elements are pushed into the target; nullish entries are skipped.
175
+ * @returns The mutated target array, or a new array if the target was nullish.
176
176
  */
177
177
  export declare function mergeArraysIntoArray<T>(target: Maybe<T[]>, ...arrays: Maybe<T[]>[]): T[];
178
178
  /**
179
179
  * Pushes the input value into the target array if it is not an array. If it is an array, pushes all of its elements into the target array.
180
180
  *
181
- * @param target - array to push into
182
- * @param value - single value or array of values to add
183
- * @returns the mutated target array
181
+ * @param target - Array to push into.
182
+ * @param value - Single value or array of values to add.
183
+ * @returns The mutated target array.
184
184
  */
185
185
  export declare function pushItemOrArrayItemsIntoArray<T>(target: T[], value: ArrayOrValue<T>): T[];
186
186
  /**
@@ -188,22 +188,22 @@ export declare function pushItemOrArrayItemsIntoArray<T>(target: T[], value: Arr
188
188
  *
189
189
  * This is preferable in cases where immutability is not required.
190
190
  *
191
- * @param target - array to push elements into
192
- * @param array - source array whose elements are pushed into the target
193
- * @returns the mutated target array
191
+ * @param target - Array to push elements into.
192
+ * @param array - Source array whose elements are pushed into the target.
193
+ * @returns The mutated target array.
194
194
  */
195
195
  export declare function pushArrayItemsIntoArray<T>(target: T[], array: T[]): T[];
196
196
  /**
197
197
  * Copies/takes the elements from the front of the array up to the specified maximum.
198
198
  *
199
+ * @param values - Source array to take from.
200
+ * @param maxToTake - Maximum number of elements to take from the front.
201
+ * @returns A new array containing at most maxToTake elements from the front.
202
+ *
199
203
  * @dbxUtil
200
204
  * @dbxUtilCategory array
201
205
  * @dbxUtilTags array, take, front, head, slice, limit
202
206
  * @dbxUtilRelated take-last, split-front
203
- *
204
- * @param values - source array to take from
205
- * @param maxToTake - maximum number of elements to take from the front
206
- * @returns a new array containing at most maxToTake elements from the front
207
207
  */
208
208
  export declare function takeFront<T>(values: T[], maxToTake: number): T[];
209
209
  /**
@@ -226,59 +226,60 @@ export interface SplitFrontResult<T> {
226
226
  /**
227
227
  * Splits the array into two arrays, the first being the front of the array up to the maxToTake, and the second being the remaining values.
228
228
  *
229
+ * @param values - Source items to partition into front + remaining halves.
230
+ * @param maxToTake - Upper bound on how many entries to take from the start.
231
+ * @returns Pair containing the leading slice plus everything left over.
232
+ *
229
233
  * @dbxUtil
230
234
  * @dbxUtilCategory array
231
235
  * @dbxUtilTags array, split, partition, front, slice
232
236
  * @dbxUtilRelated take-front, take-last
233
- *
234
- * @param values The array to split.
235
- * @param maxToTake The maximum number of values to take from the front of the array.
236
- * @returns The front and remaining values.
237
237
  */
238
238
  export declare function splitFront<T>(values: T[], maxToTake: number): SplitFrontResult<T>;
239
239
  /**
240
240
  * Copies/takes as many elements as possible from the end.
241
241
  *
242
+ * @param values - Values to take from.
243
+ * @param maxToTake - Max number of values to take from the end of the input array.
244
+ * @param keepFromFront - Number of values to retain in the front of the array. These are not taken.
245
+ * @returns New array with the subset of taken values.
246
+ * @throws {Error} When `maxToTake` is smaller than `keepFromFront`.
247
+ *
242
248
  * @dbxUtil
243
249
  * @dbxUtilCategory array
244
250
  * @dbxUtilTags array, take, last, tail, end, slice, limit
245
251
  * @dbxUtilRelated take-front, split-front
246
- *
247
- * @param values Values to take from.
248
- * @param maxToTake Max number of values to take from the end of the input array.
249
- * @param keepFromFront Number of values to retain in the front of the array. These are not taken.
250
- * @returns New array with the subset of taken values.
251
252
  */
252
253
  export declare function takeLast<T>(values: T[], maxToTake: number, keepFromFront?: number): T[];
253
254
  /**
254
255
  * Performs a forEach iteration over the input and returns the resulting array. If the input is nullish, returns an empty array.
255
256
  *
256
- * @param array - single value, array, or nullish value to iterate over
257
- * @param forEach - callback invoked for each element
258
- * @returns the array that was iterated over, or an empty array if the input was nullish
257
+ * @param array - Single value, array, or nullish value to iterate over.
258
+ * @param forEach - Callback invoked for each element.
259
+ * @returns Items iterated by the callback; empty when the input was nullish.
259
260
  */
260
261
  export declare function forEachWithArray<T>(array: Maybe<ArrayOrValue<T>>, forEach: (value: T) => void): T[];
261
262
  /**
262
263
  * Counts the total number of elements across all inner arrays of a nested array.
263
264
  *
265
+ * @param array - Two-dimensional array whose elements are counted.
266
+ * @returns The total number of elements across all inner arrays.
267
+ *
264
268
  * @dbxUtil
265
269
  * @dbxUtilCategory array
266
270
  * @dbxUtilTags array, count, nested, total, length, two-dimensional
267
271
  * @dbxUtilRelated flatten-array
268
- *
269
- * @param array - two-dimensional array whose elements are counted
270
- * @returns the total number of elements across all inner arrays
271
272
  */
272
273
  export declare function countAllInNestedArray<T>(array: T[][]): number;
273
274
  /**
274
275
  * Creates a copy of the array with the items at the specified indexes removed.
275
276
  *
277
+ * @param array - Source array to copy from.
278
+ * @param removeIndexes - Indexes of elements to exclude from the copy.
279
+ * @returns A new array without the elements at the specified indexes.
280
+ *
276
281
  * @dbxUtil
277
282
  * @dbxUtilCategory array
278
283
  * @dbxUtilTags array, remove, exclude, indexes, filter, copy
279
- *
280
- * @param array - source array to copy from
281
- * @param removeIndexes - indexes of elements to exclude from the copy
282
- * @returns a new array without the elements at the specified indexes
283
284
  */
284
285
  export declare function removeValuesAtIndexesFromArrayCopy<T>(array: T[], removeIndexes: IterableOrValue<number>): T[];
@@ -1,3 +1,4 @@
1
+ import { type Maybe } from '../value/maybe.type';
1
2
  import { type Factory, type FactoryWithIndex, type FactoryWithRequiredInput } from '../getter/getter';
2
3
  import { type AsyncMapFunction } from '../value/map';
3
4
  /**
@@ -21,28 +22,30 @@ export type AsyncArrayInputFactory<I, O> = AsyncMapFunction<ArrayInputFactory<I,
21
22
  /**
22
23
  * Creates a new ArrayFactory that generates multiple values.
23
24
  *
25
+ * @param factory - Per-item producer invoked once per requested element.
26
+ * @returns Count-driven generator that materializes the requested number of items.
27
+ *
24
28
  * @dbxUtil
25
29
  * @dbxUtilCategory array
26
30
  * @dbxUtilKind factory
27
31
  * @dbxUtilTags array, factory, generate, make, build, create
28
32
  * @dbxUtilRelated array-input-factory, terminating-factory-from-array
29
33
  *
30
- * @param factory - The factory function used to generate each item
31
- * @returns A function that takes a count parameter and returns an array of generated items
32
34
  * @__NO_SIDE_EFFECTS__
33
35
  */
34
36
  export declare function arrayFactory<T>(factory: Factory<T> | FactoryWithIndex<T>): ArrayFactory<T>;
35
37
  /**
36
38
  * Creates an ArrayInputFactory that transforms input values into output values.
37
39
  *
40
+ * @param factory - Per-element producer invoked with each input value plus its index.
41
+ * @returns Adapter that runs `factory` against every input element to produce the mapped output array.
42
+ *
38
43
  * @dbxUtil
39
44
  * @dbxUtilCategory array
40
45
  * @dbxUtilKind factory
41
46
  * @dbxUtilTags array, factory, transform, map, generate, build
42
47
  * @dbxUtilRelated array-factory
43
48
  *
44
- * @param factory - The factory function used to transform each input value
45
- * @returns A function that takes an array of input values and returns an array of output values
46
49
  * @__NO_SIDE_EFFECTS__
47
50
  */
48
51
  export declare function arrayInputFactory<O, I>(factory: FactoryWithRequiredInput<O, I>): ArrayInputFactory<I, O>;
@@ -54,7 +57,7 @@ export declare function arrayInputFactory<O, I>(factory: FactoryWithRequiredInpu
54
57
  * @param array - The source array to pull values from
55
58
  * @returns A factory function that returns items from the array or null when exhausted
56
59
  */
57
- export declare function terminatingFactoryFromArray<T>(array: T[]): Factory<T | null>;
60
+ export declare function terminatingFactoryFromArray<T>(array: T[]): Factory<Maybe<T>>;
58
61
  /**
59
62
  * Creates a factory that returns the items from the input array and returns the specified terminating value when the array is exhausted.
60
63
  *
@@ -1,3 +1,4 @@
1
+ import { type Maybe } from '../value/maybe.type';
1
2
  import { type MapFunction } from '../value/map';
2
3
  import { type DecisionFunction } from '../value/decision';
3
4
  import { type AscendingSortCompareFunction } from '../sort';
@@ -9,24 +10,24 @@ import { type AscendingSortCompareFunction } from '../sort';
9
10
  *
10
11
  * If order is irrelevant, use filterValuesByDistanceNoOrder() instead.
11
12
  *
12
- * @param input - The array of values to filter
13
- * @param minDistance - The minimum distance required between values (inclusive)
14
- * @param getValue - Function that extracts a numeric value from each item for distance comparison
15
- * @returns A filtered array with only values that are at least minDistance apart, in their original input order
13
+ * @param input - Candidate items to dedupe along the value axis.
14
+ * @param minDistance - Inclusive gap that adjacent kept values must satisfy.
15
+ * @param getValue - Resolver that maps each item to a numeric coordinate; null skips the item.
16
+ * @returns Subset of `input` preserved in original index order with min-distance enforced.
16
17
  */
17
- export declare function filterValuesByDistance<T>(input: T[], minDistance: number, getValue: (value: T) => number | null): T[];
18
+ export declare function filterValuesByDistance<T>(input: T[], minDistance: number, getValue: (value: T) => Maybe<number>): T[];
18
19
  /**
19
20
  * Filters the input values by an arbitrary "distance"/difference from each other and returns the values sorted by their determined distance.
20
21
  *
21
22
  * This is useful in cases where many values are too "close" to each other (generally items that share the same time, or within seconds of each other), and
22
23
  * we are only interested in seeing one of those items.
23
24
  *
24
- * @param input - The array of values to filter
25
- * @param minDistance - The minimum distance required between values (inclusive)
26
- * @param getValue - Function that extracts a numeric value from each item for distance comparison
27
- * @returns A filtered array with only values that are at least minDistance apart, sorted by the extracted value
25
+ * @param input - Candidate items to dedupe along the value axis.
26
+ * @param minDistance - Inclusive gap that adjacent kept values must satisfy.
27
+ * @param getValue - Resolver that maps each item to a numeric coordinate; null skips the item.
28
+ * @returns Subset of `input` sorted ascending by extracted value with min-distance enforced.
28
29
  */
29
- export declare function filterValuesByDistanceNoOrder<T>(input: T[], minDistance: number, getValue: (value: T) => number | null): T[];
30
+ export declare function filterValuesByDistanceNoOrder<T>(input: T[], minDistance: number, getValue: (value: T) => Maybe<number>): T[];
30
31
  /**
31
32
  * Strategy used by {@link applyBestFit} and {@link makeBestFit} to pick the best-fit item and transform the rest.
32
33
  */
@@ -47,14 +48,15 @@ export interface BestFitConfig<T> {
47
48
  /**
48
49
  * Same as applyBestFit, but returns a new array, rather than modifying the existing array.
49
50
  *
51
+ * @param input - Source items considered for best-fit selection; not mutated.
52
+ * @param config - Strategy describing eligibility, comparison, and non-winner transformation.
53
+ * @returns Fresh array containing the chosen winner alongside transformed runners-up.
54
+ *
50
55
  * @dbxUtil
51
56
  * @dbxUtilCategory array
52
57
  * @dbxUtilTags array, best-fit, filter, sort, immutable
53
58
  * @dbxUtilRelated apply-best-fit, find-best-index-set-pair
54
59
  *
55
- * @param input - The array to filter for the best fit.
56
- * @param config - The best-fit strategy ({@link BestFitConfig}).
57
- * @returns A new array with only the best fit item and transformed non-best-fit items.
58
60
  * @__NO_SIDE_EFFECTS__
59
61
  */
60
62
  export declare function makeBestFit<T>(input: T[], config: BestFitConfig<T>): T[];
@@ -64,14 +66,14 @@ export declare function makeBestFit<T>(input: T[], config: BestFitConfig<T>): T[
64
66
  * For instance, if two items are selected but only one can be selected by design, this function can be used to
65
67
  * pick the best fit, and update the input array.
66
68
  *
69
+ * @param input - Mutable array whose runners-up should be rewritten in place.
70
+ * @param config - Strategy describing eligibility, comparison, and non-winner transformation.
71
+ * @returns Same `input` reference after the runner-up replacements.
72
+ *
67
73
  * @dbxUtil
68
74
  * @dbxUtilCategory array
69
75
  * @dbxUtilTags array, best-fit, filter, sort, mutable, in-place
70
76
  * @dbxUtilRelated make-best-fit, find-best-index-set-pair
71
- *
72
- * @param input - The array to modify in-place.
73
- * @param config - The best-fit strategy ({@link BestFitConfig}).
74
- * @returns The modified input array with only the best fit item and transformed non-best-fit items.
75
77
  */
76
78
  export declare function applyBestFit<T>(input: T[], config: BestFitConfig<T>): T[];
77
79
  /**
@@ -83,15 +85,16 @@ export type FilterAndMapFunction<I, O> = MapFunction<Iterable<I>, O[]>;
83
85
  * Creates a function that filters the input values and maps all matching values to a new value.
84
86
  * This is a higher-order function that combines filtering and mapping operations.
85
87
  *
88
+ * @param decisionFunction - Predicate used to decide whether each iterated item flows through.
89
+ * @param mapFunction - Transform applied to every included item.
90
+ * @returns Reusable filter-then-map operator over any iterable input.
91
+ *
86
92
  * @dbxUtil
87
93
  * @dbxUtilCategory array
88
94
  * @dbxUtilKind factory
89
95
  * @dbxUtilTags array, filter, map, transform, factory, iterable
90
96
  * @dbxUtilRelated array-decision-function
91
97
  *
92
- * @param decisionFunction - Function that determines which items to include in the result
93
- * @param mapFunction - Function that transforms each included item
94
- * @returns A function that takes an iterable of input values and returns an array of transformed values
95
98
  * @__NO_SIDE_EFFECTS__
96
99
  */
97
100
  export declare function filterAndMapFunction<I, O>(decisionFunction: DecisionFunction<I>, mapFunction: MapFunction<I, O>): FilterAndMapFunction<I, O>;
@@ -13,29 +13,30 @@ export type ArrayDecisionFunction<T> = (values: T[]) => boolean;
13
13
  * When mode is `'any'`, the resulting function returns `true` if at least one element satisfies the predicate.
14
14
  * When mode is `'all'`, it returns `true` only if every element satisfies the predicate.
15
15
  *
16
+ * @param decision - Predicate used to test individual elements.
17
+ * @param mode - Whether all or any elements must satisfy the predicate.
18
+ * @returns Predicate operating on whole arrays driven by the configured aggregation mode.
19
+ *
16
20
  * @dbxUtil
17
21
  * @dbxUtilCategory array
18
22
  * @dbxUtilKind factory
19
23
  * @dbxUtilTags array, decision, predicate, find, every, some, all, any, factory
20
24
  * @dbxUtilRelated array-decision
21
25
  *
22
- * @param decision - Predicate used to test individual elements.
23
- * @param mode - Whether all or any elements must satisfy the predicate.
24
- * @returns A function that evaluates an array against the configured decision criteria.
25
26
  * @__NO_SIDE_EFFECTS__
26
27
  */
27
28
  export declare function arrayDecisionFunction<T>(decision: ArrayFindDecisionFunction<T>, mode: SetIncludesMode): ArrayDecisionFunction<T>;
28
29
  /**
29
30
  * Convenience wrapper that creates and immediately invokes an {@link ArrayDecisionFunction}.
30
31
  *
31
- * @dbxUtil
32
- * @dbxUtilCategory array
33
- * @dbxUtilTags array, decision, predicate, find, every, some, all, any
34
- * @dbxUtilRelated array-decision-function
35
- *
36
32
  * @param values - Array to evaluate.
37
33
  * @param decision - Predicate used to test individual elements.
38
34
  * @param mode - Whether all or any elements must satisfy the predicate.
39
35
  * @returns `true` if the array satisfies the decision criteria for the given mode.
36
+ *
37
+ * @dbxUtil
38
+ * @dbxUtilCategory array
39
+ * @dbxUtilTags array, decision, predicate, find, every, some, all, any
40
+ * @dbxUtilRelated array-decision-function
40
41
  */
41
42
  export declare function arrayDecision<T>(values: T[], decision: ArrayFindDecisionFunction<T>, mode: SetIncludesMode): boolean;