@oliversalzburg/js-utils 0.0.18 → 0.0.19-dev.1

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 (239) hide show
  1. package/array.d.ts +39 -0
  2. package/{lib/array.js → array.js} +12 -13
  3. package/array.js.map +1 -0
  4. package/async.d.ts +28 -0
  5. package/{lib/async.js → async.js} +16 -10
  6. package/async.js.map +1 -0
  7. package/async.test.js +28 -0
  8. package/async.test.js.map +1 -0
  9. package/core.d.ts +36 -0
  10. package/core.js +3 -0
  11. package/core.js.map +1 -0
  12. package/{lib/dom → dom}/core.d.ts +8 -8
  13. package/{lib/dom → dom}/core.js +8 -8
  14. package/{lib/error-serializer.d.ts → error-serializer.d.ts} +5 -5
  15. package/{lib/error-serializer.js → error-serializer.js} +5 -5
  16. package/{lib/errors → errors}/AbstractError.d.ts +5 -5
  17. package/{lib/errors → errors}/AbstractError.js +5 -5
  18. package/{lib/errors → errors}/InternalError.d.ts +3 -3
  19. package/{lib/errors → errors}/InternalError.js +3 -3
  20. package/{lib/errors → errors}/InvalidArgumentError.d.ts +2 -2
  21. package/{lib/errors → errors}/InvalidArgumentError.js +2 -2
  22. package/{lib/errors → errors}/InvalidOperationError.d.ts +2 -2
  23. package/{lib/errors → errors}/InvalidOperationError.js +2 -2
  24. package/{lib/errors → errors}/NotImplementedError.d.ts +2 -2
  25. package/{lib/errors → errors}/NotImplementedError.js +2 -2
  26. package/{lib/errors → errors}/PermissionViolationError.d.ts +2 -2
  27. package/{lib/errors → errors}/PermissionViolationError.js +2 -2
  28. package/{lib/errors → errors}/ResourceConflictError.d.ts +2 -2
  29. package/{lib/errors → errors}/ResourceConflictError.js +2 -2
  30. package/{lib/errors → errors}/UnknownError.d.ts +2 -2
  31. package/{lib/errors → errors}/UnknownError.js +2 -2
  32. package/{lib/graphics → graphics}/canvas-sandbox.d.ts +13 -13
  33. package/{lib/graphics → graphics}/canvas-sandbox.js +9 -9
  34. package/{lib/graphics → graphics}/canvas.d.ts +30 -30
  35. package/{lib/graphics → graphics}/canvas.js +30 -30
  36. package/{lib/graphics → graphics}/core.d.ts +23 -23
  37. package/{lib/graphics → graphics}/core.js +23 -24
  38. package/{lib/graphics → graphics}/core.js.map +1 -1
  39. package/{lib/graphics → graphics}/render-loop.d.ts +3 -3
  40. package/{lib/graphics → graphics}/render-loop.js +3 -3
  41. package/{lib/math → math}/core.d.ts +19 -10
  42. package/{lib/math → math}/core.js +21 -10
  43. package/{lib/math → math}/core.js.map +1 -1
  44. package/{lib/math → math}/euler.d.ts +4 -4
  45. package/{lib/math → math}/euler.js +4 -4
  46. package/{lib/math → math}/matrix3.d.ts +34 -34
  47. package/{lib/math → math}/matrix3.js +34 -34
  48. package/{lib/math → math}/quaternion.d.ts +25 -25
  49. package/{lib/math → math}/quaternion.js +25 -25
  50. package/{lib/math → math}/transformation.d.ts +3 -3
  51. package/{lib/math → math}/transformation.js +3 -3
  52. package/{lib/math → math}/vector2.d.ts +40 -40
  53. package/{lib/math → math}/vector2.js +40 -40
  54. package/{lib/math → math}/vector3.d.ts +66 -66
  55. package/{lib/math → math}/vector3.js +66 -66
  56. package/{lib/math → math}/vector4.d.ts +38 -38
  57. package/{lib/math → math}/vector4.js +38 -38
  58. package/{lib/nil.d.ts → nil.d.ts} +11 -9
  59. package/{lib/nil.js → nil.js} +10 -9
  60. package/{lib/nil.js.map → nil.js.map} +1 -1
  61. package/package.json +16 -18
  62. package/{lib/random.d.ts → random.d.ts} +11 -17
  63. package/{lib/random.js → random.js} +11 -17
  64. package/random.js.map +1 -0
  65. package/{lib/sleep.d.ts → sleep.d.ts} +1 -1
  66. package/{lib/sleep.js → sleep.js} +1 -1
  67. package/{lib/string-formatter.d.ts → string-formatter.d.ts} +8 -4
  68. package/{lib/string-formatter.js → string-formatter.js} +8 -4
  69. package/string-formatter.js.map +1 -0
  70. package/string-formatter.test.d.ts +1 -0
  71. package/tsconfig.tsbuildinfo +1 -0
  72. package/LICENSES.md +0 -17
  73. package/_site/assets/highlight.css +0 -141
  74. package/_site/assets/main.js +0 -59
  75. package/_site/assets/navigation.js +0 -1
  76. package/_site/assets/search.js +0 -1
  77. package/_site/assets/style.css +0 -1383
  78. package/_site/classes/AbstractError.html +0 -67
  79. package/_site/classes/Canvas.html +0 -106
  80. package/_site/classes/CanvasSandbox.html +0 -91
  81. package/_site/classes/Euler.html +0 -217
  82. package/_site/classes/InternalError.html +0 -71
  83. package/_site/classes/InvalidArgumentError.html +0 -67
  84. package/_site/classes/InvalidOperationError.html +0 -67
  85. package/_site/classes/Matrix3.html +0 -167
  86. package/_site/classes/NotImplementedError.html +0 -66
  87. package/_site/classes/PermissionViolationError.html +0 -67
  88. package/_site/classes/Quaternion.html +0 -211
  89. package/_site/classes/Random.html +0 -90
  90. package/_site/classes/RenderLoop.html +0 -85
  91. package/_site/classes/ResourceConflictError.html +0 -66
  92. package/_site/classes/Transformation.html +0 -52
  93. package/_site/classes/UnexpectedNilError.html +0 -54
  94. package/_site/classes/UnknownError.html +0 -70
  95. package/_site/classes/Vector2.html +0 -159
  96. package/_site/classes/Vector3.html +0 -214
  97. package/_site/classes/Vector4.html +0 -156
  98. package/_site/functions/addVector2.html +0 -44
  99. package/_site/functions/addVector3.html +0 -44
  100. package/_site/functions/blend.html +0 -47
  101. package/_site/functions/blendAdditive.html +0 -47
  102. package/_site/functions/blendSubtractive.html +0 -47
  103. package/_site/functions/clamp.html +0 -45
  104. package/_site/functions/coalesceOnRejection.html +0 -51
  105. package/_site/functions/cosDeg.html +0 -43
  106. package/_site/functions/crossVector3.html +0 -44
  107. package/_site/functions/deg2rad.html +0 -43
  108. package/_site/functions/difference.html +0 -46
  109. package/_site/functions/distance.html +0 -46
  110. package/_site/functions/dotVector3.html +0 -44
  111. package/_site/functions/errorToJSON.html +0 -43
  112. package/_site/functions/errorToRecord.html +0 -43
  113. package/_site/functions/errorToSimpleSerializable.html +0 -43
  114. package/_site/functions/filterType.html +0 -46
  115. package/_site/functions/formatString.html +0 -46
  116. package/_site/functions/formatStringTemplate.html +0 -46
  117. package/_site/functions/fromRGB.html +0 -46
  118. package/_site/functions/fromRGBA.html +0 -46
  119. package/_site/functions/getA.html +0 -43
  120. package/_site/functions/getB.html +0 -43
  121. package/_site/functions/getDocumentElementTypeById.html +0 -46
  122. package/_site/functions/getDocumentElementTypeByIdStrict.html +0 -48
  123. package/_site/functions/getG.html +0 -43
  124. package/_site/functions/getR.html +0 -43
  125. package/_site/functions/intersect.html +0 -47
  126. package/_site/functions/is.html +0 -46
  127. package/_site/functions/isError.html +0 -43
  128. package/_site/functions/isInteger.html +0 -43
  129. package/_site/functions/isNil.html +0 -44
  130. package/_site/functions/isqrt.html +0 -43
  131. package/_site/functions/multiplyVector2.html +0 -44
  132. package/_site/functions/multiplyVector3.html +0 -44
  133. package/_site/functions/mustExist.html +0 -45
  134. package/_site/functions/nextPalette.html +0 -42
  135. package/_site/functions/prepareAsyncContext.html +0 -46
  136. package/_site/functions/putPixel32.html +0 -53
  137. package/_site/functions/putPixel32Add.html +0 -53
  138. package/_site/functions/putPixel32Sub.html +0 -53
  139. package/_site/functions/putSubPixel32.html +0 -47
  140. package/_site/functions/rad2deg.html +0 -43
  141. package/_site/functions/randomRange.html +0 -45
  142. package/_site/functions/safeRGBComponent.html +0 -43
  143. package/_site/functions/seedFromString.html +0 -44
  144. package/_site/functions/shuffleArray.html +0 -44
  145. package/_site/functions/sinDeg.html +0 -43
  146. package/_site/functions/sleep.html +0 -43
  147. package/_site/functions/somecolor.html +0 -43
  148. package/_site/functions/subtractVector2.html +0 -44
  149. package/_site/functions/subtractVector3.html +0 -44
  150. package/_site/functions/toGrayScale.html +0 -43
  151. package/_site/functions/unknownToError.html +0 -45
  152. package/_site/index.html +0 -44
  153. package/_site/interfaces/CanvasOptions.html +0 -44
  154. package/_site/interfaces/CanvasSandboxApplication.html +0 -60
  155. package/_site/interfaces/CanvasSandboxExpectedOptions.html +0 -48
  156. package/_site/interfaces/CanvasSandboxOptions.html +0 -45
  157. package/_site/interfaces/RenderLoopOptions.html +0 -46
  158. package/_site/modules.html +0 -134
  159. package/_site/types/AnyAsyncFunction.html +0 -41
  160. package/_site/types/AnyConstructor.html +0 -41
  161. package/_site/types/AnyFunction.html +0 -41
  162. package/_site/types/ConstructorOf.html +0 -41
  163. package/_site/types/FunctionReturning.html +0 -41
  164. package/_site/types/Maybe.html +0 -41
  165. package/_site/types/Mixin.html +0 -42
  166. package/_site/types/Nil.html +0 -42
  167. package/_site/types/RenderLoopCallback.html +0 -41
  168. package/_site/types/SerializedError.html +0 -41
  169. package/_site/variables/CANVAS_SANDBOX_DEFAULT_CSS.html +0 -41
  170. package/_site/variables/MS_PER_FRAME_60FPS.html +0 -42
  171. package/_site/variables/PALETTES.html +0 -41
  172. package/_site/variables/TWO_PI.html +0 -41
  173. package/_site/variables/random-1.html +0 -41
  174. package/coverage/base.css +0 -224
  175. package/coverage/block-navigation.js +0 -87
  176. package/coverage/bundle.js +0 -30
  177. package/coverage/favicon.png +0 -0
  178. package/coverage/index.html +0 -16
  179. package/coverage/prettify.css +0 -1
  180. package/coverage/prettify.js +0 -2
  181. package/coverage/sort-arrow-sprite.png +0 -0
  182. package/coverage/sorter.js +0 -196
  183. package/coverage/spa.css +0 -298
  184. package/coverage/string-formatter.ts.html +0 -187
  185. package/coverage/tmp/coverage-4186-1699218521999-0.json +0 -1
  186. package/coverage/tmp/coverage-4196-1699218521967-0.json +0 -1
  187. package/docs/assets/favicon.ico +0 -0
  188. package/lib/array.d.ts +0 -40
  189. package/lib/array.js.map +0 -1
  190. package/lib/async.d.ts +0 -27
  191. package/lib/async.js.map +0 -1
  192. package/lib/core.d.ts +0 -33
  193. package/lib/core.js +0 -12
  194. package/lib/core.js.map +0 -1
  195. package/lib/random.js.map +0 -1
  196. package/lib/string-formatter.js.map +0 -1
  197. package/mkdocs.yml +0 -52
  198. /package/{lib/error-serializer.test.d.ts → async.test.d.ts} +0 -0
  199. /package/{lib/dom → dom}/core.js.map +0 -0
  200. /package/{lib/dom → dom}/index.d.ts +0 -0
  201. /package/{lib/dom → dom}/index.js +0 -0
  202. /package/{lib/dom → dom}/index.js.map +0 -0
  203. /package/{lib/error-serializer.js.map → error-serializer.js.map} +0 -0
  204. /package/{lib/string-formatter.test.d.ts → error-serializer.test.d.ts} +0 -0
  205. /package/{lib/error-serializer.test.js → error-serializer.test.js} +0 -0
  206. /package/{lib/error-serializer.test.js.map → error-serializer.test.js.map} +0 -0
  207. /package/{lib/errors → errors}/AbstractError.js.map +0 -0
  208. /package/{lib/errors → errors}/InternalError.js.map +0 -0
  209. /package/{lib/errors → errors}/InvalidArgumentError.js.map +0 -0
  210. /package/{lib/errors → errors}/InvalidOperationError.js.map +0 -0
  211. /package/{lib/errors → errors}/NotImplementedError.js.map +0 -0
  212. /package/{lib/errors → errors}/PermissionViolationError.js.map +0 -0
  213. /package/{lib/errors → errors}/ResourceConflictError.js.map +0 -0
  214. /package/{lib/errors → errors}/UnknownError.js.map +0 -0
  215. /package/{lib/errors → errors}/index.d.ts +0 -0
  216. /package/{lib/errors → errors}/index.js +0 -0
  217. /package/{lib/errors → errors}/index.js.map +0 -0
  218. /package/{lib/graphics → graphics}/canvas-sandbox.js.map +0 -0
  219. /package/{lib/graphics → graphics}/canvas.js.map +0 -0
  220. /package/{lib/graphics → graphics}/index.d.ts +0 -0
  221. /package/{lib/graphics → graphics}/index.js +0 -0
  222. /package/{lib/graphics → graphics}/index.js.map +0 -0
  223. /package/{lib/graphics → graphics}/render-loop.js.map +0 -0
  224. /package/{lib/index.d.ts → index.d.ts} +0 -0
  225. /package/{lib/index.js → index.js} +0 -0
  226. /package/{lib/index.js.map → index.js.map} +0 -0
  227. /package/{lib/math → math}/euler.js.map +0 -0
  228. /package/{lib/math → math}/index.d.ts +0 -0
  229. /package/{lib/math → math}/index.js +0 -0
  230. /package/{lib/math → math}/index.js.map +0 -0
  231. /package/{lib/math → math}/matrix3.js.map +0 -0
  232. /package/{lib/math → math}/quaternion.js.map +0 -0
  233. /package/{lib/math → math}/transformation.js.map +0 -0
  234. /package/{lib/math → math}/vector2.js.map +0 -0
  235. /package/{lib/math → math}/vector3.js.map +0 -0
  236. /package/{lib/math → math}/vector4.js.map +0 -0
  237. /package/{lib/sleep.js.map → sleep.js.map} +0 -0
  238. /package/{lib/string-formatter.test.js → string-formatter.test.js} +0 -0
  239. /package/{lib/string-formatter.test.js.map → string-formatter.test.js.map} +0 -0
package/array.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { ConstructorOf } from "./core.js";
2
+ /**
3
+ * Places the items in the array in random order.
4
+ * @param array - The array to shuffle.
5
+ * @typeParam TElements - The type of the elements in the array.
6
+ * @returns The passed array in random order.
7
+ * @group Array
8
+ */
9
+ export declare const shuffleArray: <TElements>(array: TElements[]) => TElements[];
10
+ /**
11
+ * Returns an array that holds all items that appear in both
12
+ * passed arrays.
13
+ * @param a - The first array.
14
+ * @param b - The second array.
15
+ * @typeParam TElements - The type of the elements in the array.
16
+ * @returns A new array which holds the items that appear in
17
+ * both passed arrays.
18
+ * @group Array
19
+ */
20
+ export declare const intersect: <TElements>(a: TElements[], b: TElements[]) => TElements[];
21
+ /**
22
+ * Returns an array that holds all items that only appear in `a`.
23
+ * @param a - The first array.
24
+ * @param b - The second array.
25
+ * @typeParam TElements - The type of the elements in the array.
26
+ * @returns A new array which holds the items that ony appear in `a`.
27
+ * @group Array
28
+ */
29
+ export declare const difference: <TElements>(a: TElements[], b: TElements[]) => TElements[];
30
+ /**
31
+ * From an array with unknown contents, retrieve all the elements
32
+ * that are of a certain type and return them as a new array.
33
+ * @param array - The array to filter.
34
+ * @param InstanceType - The type to search for.
35
+ * @typeParam TElements - The type of the elements in the array.
36
+ * @returns A new array with the filtered items.
37
+ * @group Array
38
+ */
39
+ export declare const filterType: <TElements>(array: Array<unknown>, InstanceType: ConstructorOf<TElements>) => TElements[];
@@ -1,8 +1,8 @@
1
1
  import { is } from "./nil.js";
2
2
  /**
3
3
  * Places the items in the array in random order.
4
- * @param array The array to shuffle.
5
- * @template {unknown} T The type of the elements in the array.
4
+ * @param array - The array to shuffle.
5
+ * @typeParam TElements - The type of the elements in the array.
6
6
  * @returns The passed array in random order.
7
7
  * @group Array
8
8
  */
@@ -18,9 +18,9 @@ export const shuffleArray = (array) => {
18
18
  /**
19
19
  * Returns an array that holds all items that appear in both
20
20
  * passed arrays.
21
- * @param a The first array.
22
- * @param b The second array.
23
- * @template {unknown} T The type of the elements in the array.
21
+ * @param a - The first array.
22
+ * @param b - The second array.
23
+ * @typeParam TElements - The type of the elements in the array.
24
24
  * @returns A new array which holds the items that appear in
25
25
  * both passed arrays.
26
26
  * @group Array
@@ -30,11 +30,10 @@ export const intersect = (a, b) => {
30
30
  };
31
31
  /**
32
32
  * Returns an array that holds all items that only appear in `a`.
33
- * @param a The first array.
34
- * @param b The second array.
35
- * @template {unknown} T The type of the elements in the array.
36
- * @returns A new array which holds the items that ony appear
37
- * in `a`.
33
+ * @param a - The first array.
34
+ * @param b - The second array.
35
+ * @typeParam TElements - The type of the elements in the array.
36
+ * @returns A new array which holds the items that ony appear in `a`.
38
37
  * @group Array
39
38
  */
40
39
  export const difference = (a, b) => {
@@ -43,9 +42,9 @@ export const difference = (a, b) => {
43
42
  /**
44
43
  * From an array with unknown contents, retrieve all the elements
45
44
  * that are of a certain type and return them as a new array.
46
- * @param array The array to filter.
47
- * @param InstanceType The type to search for.
48
- * @template {unknown} T The type of the elements in the array.
45
+ * @param array - The array to filter.
46
+ * @param InstanceType - The type to search for.
47
+ * @typeParam TElements - The type of the elements in the array.
49
48
  * @returns A new array with the filtered items.
50
49
  * @group Array
51
50
  */
package/array.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.js","sourceRoot":"","sources":["../source/array.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAY,KAAuB,EAAE,EAAE;IACjE,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;QAClC,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;KAC3B;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAY,CAAmB,EAAE,CAAmB,EAAE,EAAE;IAC/E,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAY,CAAmB,EAAE,CAAmB,EAAE,EAAE;IAChF,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAqB,EACrB,YAAsC,EACtC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAqB,CAAC"}
package/async.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { AnyAsyncFunction, AnyFunctionReturning, ConstructorOf } from "./core.js";
2
+ /**
3
+ * Wraps the given asynchronous function in a new function that will ignore any outcome of
4
+ * the context as it resolves.
5
+ *
6
+ * This can be useful when providing asynchonous event handler to `.addEventlistener()`,
7
+ * which only expects synchronous functions.
8
+ * @param context - The asynchronous function to exectute.
9
+ * @typeParam TArguments - The type of the arguments that your function expects.
10
+ * @returns A function returning nothing.
11
+ * @group Async
12
+ */
13
+ export declare const prepareAsyncContext: <TArguments extends unknown[]>(context: AnyAsyncFunction) => (...args: TArguments) => void;
14
+ /**
15
+ * Executes an asynchronous function and resolves with an alternative result
16
+ * in case the function failed.
17
+ * @param executable - The asynchronous function to execute.
18
+ * @param to - The result we want to return when the function errors.
19
+ * @param filter - An {@linkcode !Error} subclass. If defined, only errors of
20
+ * this type will be coalesced.
21
+ * @typeParam TExecutableReturn - The return type of the function.
22
+ * @typeParam TCoalesce - The type of the object to coalesce to.
23
+ * @typeParam TFilter - The type of the error filter.
24
+ * @returns Whatever the function resolved to, or the provided replacement,
25
+ * in case the function failed.
26
+ * @group Async
27
+ */
28
+ export declare const coalesceOnRejection: <TExecutableReturn, TCoalesce, TFilter extends ConstructorOf<Error>>(executable: AnyFunctionReturning<TExecutableReturn | Promise<TExecutableReturn>>, to: TCoalesce, filter?: TFilter | undefined) => Promise<TExecutableReturn | TCoalesce>;
@@ -4,27 +4,33 @@
4
4
  *
5
5
  * This can be useful when providing asynchonous event handler to `.addEventlistener()`,
6
6
  * which only expects synchronous functions.
7
- * @param context The asynchronous function to exectute.
7
+ * @param context - The asynchronous function to exectute.
8
+ * @typeParam TArguments - The type of the arguments that your function expects.
8
9
  * @returns A function returning nothing.
9
10
  * @group Async
10
11
  */
11
12
  export const prepareAsyncContext = (context) => {
12
- return () => {
13
- void context()
13
+ return (
14
+ /**
15
+ * The arguments that our new function was called with.
16
+ */
17
+ ...args) => {
18
+ void context(...args)
14
19
  .then(() => undefined)
15
- .catch(() => undefined);
20
+ // eslint-disable-next-line no-console
21
+ .catch(console.error);
16
22
  };
17
23
  };
18
24
  /**
19
25
  * Executes an asynchronous function and resolves with an alternative result
20
26
  * in case the function failed.
21
- * @param executable The asynchronous function to execute.
22
- * @param to The result we want to return when the function errors.
23
- * @param filter An {@linkcode !Error} subclass. If defined, only errors of
27
+ * @param executable - The asynchronous function to execute.
28
+ * @param to - The result we want to return when the function errors.
29
+ * @param filter - An {@linkcode !Error} subclass. If defined, only errors of
24
30
  * this type will be coalesced.
25
- * @template {unknown} TExecutableReturn The return type of the function.
26
- * @template {unknown} TCoalesce The type of the object to coalesce to.
27
- * @template {ConstructorOf<Error>} TFilter The type of the error filter.
31
+ * @typeParam TExecutableReturn - The return type of the function.
32
+ * @typeParam TCoalesce - The type of the object to coalesce to.
33
+ * @typeParam TFilter - The type of the error filter.
28
34
  * @returns Whatever the function resolved to, or the provided replacement,
29
35
  * in case the function failed.
30
36
  * @group Async
package/async.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.js","sourceRoot":"","sources":["../source/async.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAyB,EACzB,EAAE;IACF,OAAO;IACL;;OAEG;IACH,GAAG,IAAgB,EACnB,EAAE;QACF,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;aAClB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;YACtB,sCAAsC;aACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAKtC,UAAgF,EAChF,EAAa,EACb,MAAgB,EAChB,EAAE;IACF,IAAI;QACF,OAAO,MAAM,UAAU,EAAE,CAAC;KAC3B;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,YAAY,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE;YAChE,OAAO,EAAE,CAAC;SACX;QACD,MAAM,KAAK,CAAC;KACb;AACH,CAAC,CAAC"}
package/async.test.js ADDED
@@ -0,0 +1,28 @@
1
+ /* eslint-disable no-unused-expressions */
2
+ import { expect } from "chai";
3
+ import { it } from "mocha";
4
+ import { prepareAsyncContext } from "./async.js";
5
+ import { sleep } from "./sleep.js";
6
+ it("executes trivial callback", async () => {
7
+ let executed = false;
8
+ const callback = prepareAsyncContext(async () => {
9
+ await sleep(1);
10
+ executed = true;
11
+ });
12
+ callback();
13
+ await sleep(100);
14
+ expect(executed).to.be.true;
15
+ });
16
+ it("passes parameters to callback", async () => {
17
+ let executed = false;
18
+ const callback = prepareAsyncContext(async (event, eventId) => {
19
+ expect(event.name).to.equal("call");
20
+ expect(eventId).to.equal(42);
21
+ await sleep(1);
22
+ executed = true;
23
+ });
24
+ callback({ name: "call" }, 42);
25
+ await sleep(100);
26
+ expect(executed).to.be.true;
27
+ });
28
+ //# sourceMappingURL=async.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.test.js","sourceRoot":"","sources":["../source/async.test.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;IACzC,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,IAAI,EAAE;QAC9C,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;QACf,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,QAAQ,EAAE,CAAC;IAEX,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjB,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;IAC7C,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE,KAA6B,EAAE,OAAe,EAAE,EAAE;QAC5F,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAE7B,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;QACf,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAE/B,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjB,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CAAC"}
package/core.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Describes a function that is a constructor for something.
3
+ * @typeParam TConstructed - The type this is a constructor for.
4
+ */
5
+ export type ConstructorOf<TConstructed> = new (...args: Array<any>) => TConstructed;
6
+ /**
7
+ * Describes any function.
8
+ */
9
+ export type AnyFunction = (...args: Array<any>) => any;
10
+ /**
11
+ * Describes any asynchronous function.
12
+ */
13
+ export type AnyAsyncFunction = (...args: Array<any>) => Promise<any>;
14
+ /**
15
+ * Any constructor
16
+ */
17
+ export type AnyConstructor = new (...args: Array<any>) => any;
18
+ /**
19
+ * Describes a function returning an instance of a given type.
20
+ * @typeParam TReturned - The type of the item returned by the function.
21
+ */
22
+ export type AnyFunctionReturning<TReturned = any> = (...args: Array<any>) => TReturned;
23
+ /**
24
+ * Describes an async function returning an instance of a given type.
25
+ * @typeParam TReturned - The type of the item returned by the function.
26
+ */
27
+ export type AnyAsyncFunctionReturning<TReturned = any> = (...args: Array<any>) => TReturned;
28
+ /**
29
+ * Describes a class "mixin", which is a function that returns a dynamically
30
+ * constructed class, based on the passed parameters.
31
+ *
32
+ * **Hint**: Don't use mixins.
33
+ * @typeParam TTarget - The type of the classed this mixin is being
34
+ * mixed in with.
35
+ */
36
+ export type Mixin<TTarget extends AnyFunctionReturning> = InstanceType<ReturnType<TTarget>>;
package/core.js ADDED
@@ -0,0 +1,3 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export {};
3
+ //# sourceMappingURL=core.js.map
package/core.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../source/core.ts"],"names":[],"mappings":"AAAA,uDAAuD"}
@@ -3,21 +3,21 @@ import { ConstructorOf } from "../core.js";
3
3
  /**
4
4
  * Retrieves an element from the document and returns it if it is
5
5
  * non-null and has the expected type. Otherwise an error is thrown.
6
- * @param document The document from which to look up the element.
7
- * @param id The ID of the element.
8
- * @param Type The type you expect the element to have.
6
+ * @param document - The document from which to look up the element.
7
+ * @param id - The ID of the element.
8
+ * @param Type - The type you expect the element to have.
9
9
  * @returns The requested element, if it has the expected type.
10
- * @throws {InvalidOperationError} When the document element has an unexpected type.
11
- * @throws {UnexpectedNilError} When the the document element is `null`.
10
+ * @throws {@linkcode InvalidOperationError} When the document element has an unexpected type.
11
+ * @throws {@linkcode UnexpectedNilError} When the the document element is `null`.
12
12
  * @group DOM
13
13
  */
14
14
  export declare const getDocumentElementTypeByIdStrict: <T extends HTMLElement>(document: Document, id: string, Type: ConstructorOf<T>) => T;
15
15
  /**
16
16
  * Retrieves an element from the document and returns it if it has the
17
17
  * expected type.
18
- * @param document The document from which to look up the element.
19
- * @param id The ID of the element.
20
- * @param Type The type you expect the element to have.
18
+ * @param document - The document from which to look up the element.
19
+ * @param id - The ID of the element.
20
+ * @param Type - The type you expect the element to have.
21
21
  * @returns The requested element, if it has the expected type; `null` otherwise.
22
22
  * @group DOM
23
23
  */
@@ -3,12 +3,12 @@ import { UnexpectedNilError } from "../nil.js";
3
3
  /**
4
4
  * Retrieves an element from the document and returns it if it is
5
5
  * non-null and has the expected type. Otherwise an error is thrown.
6
- * @param document The document from which to look up the element.
7
- * @param id The ID of the element.
8
- * @param Type The type you expect the element to have.
6
+ * @param document - The document from which to look up the element.
7
+ * @param id - The ID of the element.
8
+ * @param Type - The type you expect the element to have.
9
9
  * @returns The requested element, if it has the expected type.
10
- * @throws {InvalidOperationError} When the document element has an unexpected type.
11
- * @throws {UnexpectedNilError} When the the document element is `null`.
10
+ * @throws {@linkcode InvalidOperationError} When the document element has an unexpected type.
11
+ * @throws {@linkcode UnexpectedNilError} When the the document element is `null`.
12
12
  * @group DOM
13
13
  */
14
14
  export const getDocumentElementTypeByIdStrict = (document, id, Type) => {
@@ -24,9 +24,9 @@ export const getDocumentElementTypeByIdStrict = (document, id, Type) => {
24
24
  /**
25
25
  * Retrieves an element from the document and returns it if it has the
26
26
  * expected type.
27
- * @param document The document from which to look up the element.
28
- * @param id The ID of the element.
29
- * @param Type The type you expect the element to have.
27
+ * @param document - The document from which to look up the element.
28
+ * @param id - The ID of the element.
29
+ * @param Type - The type you expect the element to have.
30
30
  * @returns The requested element, if it has the expected type; `null` otherwise.
31
31
  * @group DOM
32
32
  */
@@ -6,7 +6,7 @@ import { AbstractError } from "./errors/AbstractError.js";
6
6
  export type SerializedError = Record<string, Record<string, string> | string | undefined>;
7
7
  /**
8
8
  * Determine if the given unknown subject is an {@linkcode !Error} instance.
9
- * @param subject The object to inspect.
9
+ * @param subject - The object to inspect.
10
10
  * @returns `true` if the subject is an {@linkcode !Error}, `false` otherwise.
11
11
  * @group Errors
12
12
  */
@@ -15,28 +15,28 @@ export declare const isError: (subject: unknown) => subject is Error;
15
15
  * Returns an {@linkcode AbstractError} that best represents the passed subject.
16
16
  * If the passed subject is already an {@linkcode AbstractError}, it is returned as-is.
17
17
  * Otherwise, it will be converted into an appropriate error type.
18
- * @param subject The subject to inspect
18
+ * @param subject - The subject to inspect
19
19
  * @returns An {@linkcode AbstractError} instance.
20
20
  * @group Errors
21
21
  */
22
22
  export declare const unknownToError: (subject: unknown) => AbstractError;
23
23
  /**
24
24
  * Serializes an error into a JSON string.
25
- * @param error The error to stringify.
25
+ * @param error - The error to stringify.
26
26
  * @returns A JSON string representing the error.
27
27
  * @group Errors
28
28
  */
29
29
  export declare const errorToJSON: (error: Error) => string;
30
30
  /**
31
31
  * Converts an error into a regular hash.
32
- * @param error The error to convert.
32
+ * @param error - The error to convert.
33
33
  * @returns A new object that contains all the properties of the error.
34
34
  * @group Errors
35
35
  */
36
36
  export declare const errorToRecord: (error: Error) => Record<string, unknown>;
37
37
  /**
38
38
  * Serializes an error into a simpler shape.
39
- * @param error The error to serialize.
39
+ * @param error - The error to serialize.
40
40
  * @returns A simple representation of the error.
41
41
  * @group Errors
42
42
  */
@@ -3,7 +3,7 @@ import { InternalError } from "./errors/InternalError.js";
3
3
  import { UnknownError } from "./errors/UnknownError.js";
4
4
  /**
5
5
  * Determine if the given unknown subject is an {@linkcode !Error} instance.
6
- * @param subject The object to inspect.
6
+ * @param subject - The object to inspect.
7
7
  * @returns `true` if the subject is an {@linkcode !Error}, `false` otherwise.
8
8
  * @group Errors
9
9
  */
@@ -14,7 +14,7 @@ export const isError = (subject) => {
14
14
  * Returns an {@linkcode AbstractError} that best represents the passed subject.
15
15
  * If the passed subject is already an {@linkcode AbstractError}, it is returned as-is.
16
16
  * Otherwise, it will be converted into an appropriate error type.
17
- * @param subject The subject to inspect
17
+ * @param subject - The subject to inspect
18
18
  * @returns An {@linkcode AbstractError} instance.
19
19
  * @group Errors
20
20
  */
@@ -29,7 +29,7 @@ export const unknownToError = (subject) => {
29
29
  };
30
30
  /**
31
31
  * Serializes an error into a JSON string.
32
- * @param error The error to stringify.
32
+ * @param error - The error to stringify.
33
33
  * @returns A JSON string representing the error.
34
34
  * @group Errors
35
35
  */
@@ -38,7 +38,7 @@ export const errorToJSON = (error) => {
38
38
  };
39
39
  /**
40
40
  * Converts an error into a regular hash.
41
- * @param error The error to convert.
41
+ * @param error - The error to convert.
42
42
  * @returns A new object that contains all the properties of the error.
43
43
  * @group Errors
44
44
  */
@@ -51,7 +51,7 @@ export const errorToRecord = (error) => {
51
51
  };
52
52
  /**
53
53
  * Serializes an error into a simpler shape.
54
- * @param error The error to serialize.
54
+ * @param error - The error to serialize.
55
55
  * @returns A simple representation of the error.
56
56
  * @group Errors
57
57
  */
@@ -13,15 +13,15 @@ export declare class AbstractError extends Error {
13
13
  code: string;
14
14
  /**
15
15
  * Constructs a new {@linkcode AbstractError}.
16
- * @param code The main identification code for the error.
17
- * @param message The main error message.
18
- * @param status The HTTP status code to return.
16
+ * @param code - The main identification code for the error.
17
+ * @param message - The main error message.
18
+ * @param status - The HTTP status code to return.
19
19
  */
20
20
  constructor(code: string, message: string, status: number);
21
21
  /**
22
22
  * Checks if an object is an instance of {@linkcode AbstractError}, or one of its subclasses.
23
- * @param error The object to check.
24
- * @param allowForeignModule Only check for similar looking error codes.
23
+ * @param error - The object to check.
24
+ * @param allowForeignModule - Only check for similar looking error codes.
25
25
  * You're going to want to use this if you're dealing with a setup where
26
26
  * multiple versions of js-utils are loaded.
27
27
  * @returns `true` if the object is an {@linkcode AbstractError}, `false` otherwise.
@@ -13,9 +13,9 @@ export class AbstractError extends Error {
13
13
  code;
14
14
  /**
15
15
  * Constructs a new {@linkcode AbstractError}.
16
- * @param code The main identification code for the error.
17
- * @param message The main error message.
18
- * @param status The HTTP status code to return.
16
+ * @param code - The main identification code for the error.
17
+ * @param message - The main error message.
18
+ * @param status - The HTTP status code to return.
19
19
  */
20
20
  constructor(code, message, status) {
21
21
  super(message);
@@ -30,8 +30,8 @@ export class AbstractError extends Error {
30
30
  }
31
31
  /**
32
32
  * Checks if an object is an instance of {@linkcode AbstractError}, or one of its subclasses.
33
- * @param error The object to check.
34
- * @param allowForeignModule Only check for similar looking error codes.
33
+ * @param error - The object to check.
34
+ * @param allowForeignModule - Only check for similar looking error codes.
35
35
  * You're going to want to use this if you're dealing with a setup where
36
36
  * multiple versions of js-utils are loaded.
37
37
  * @returns `true` if the object is an {@linkcode AbstractError}, `false` otherwise.
@@ -7,13 +7,13 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export declare class InternalError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode InternalError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message: string, status?: number);
14
14
  /**
15
15
  * Converts an error into an {@linkcode InternalError}.
16
- * @param error The error to convert.
16
+ * @param error - The error to convert.
17
17
  * @returns An {@linkcode InternalError} that represents the given error.
18
18
  */
19
19
  static fromError(error: Error): InternalError;
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export class InternalError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode InternalError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message, status = 500) {
14
14
  super("ERR_OS_INTERNAL", message, status);
@@ -21,7 +21,7 @@ export class InternalError extends AbstractError {
21
21
  }
22
22
  /**
23
23
  * Converts an error into an {@linkcode InternalError}.
24
- * @param error The error to convert.
24
+ * @param error - The error to convert.
25
25
  * @returns An {@linkcode InternalError} that represents the given error.
26
26
  */
27
27
  static fromError(error) {
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export declare class InvalidArgumentError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode InvalidArgumentError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message: string, status?: number);
14
14
  }
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export class InvalidArgumentError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode InvalidArgumentError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message, status = 400) {
14
14
  super("ERR_OS_INVALID_ARGUMENT", message, status);
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export declare class InvalidOperationError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode InvalidOperationError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message: string, status?: number);
14
14
  }
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export class InvalidOperationError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode InvalidOperationError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message, status = 400) {
14
14
  super("ERR_OS_INVALID_OPERATION", message, status);
@@ -6,8 +6,8 @@ import { AbstractError } from "./AbstractError.js";
6
6
  export declare class NotImplementedError extends AbstractError {
7
7
  /**
8
8
  * Constructs a new {@linkcode NotImplementedError}.
9
- * @param message The main error message.
10
- * @param status The HTTP status code to return.
9
+ * @param message - The main error message.
10
+ * @param status - The HTTP status code to return.
11
11
  */
12
12
  constructor(message: string, status?: number);
13
13
  }
@@ -6,8 +6,8 @@ import { AbstractError } from "./AbstractError.js";
6
6
  export class NotImplementedError extends AbstractError {
7
7
  /**
8
8
  * Constructs a new {@linkcode NotImplementedError}.
9
- * @param message The main error message.
10
- * @param status The HTTP status code to return.
9
+ * @param message - The main error message.
10
+ * @param status - The HTTP status code to return.
11
11
  */
12
12
  constructor(message, status = 501) {
13
13
  super("ERR_OS_NOT_IMPLEMENTED", message, status);
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export declare class PermissionViolationError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode PermissionViolationError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message: string, status?: number);
14
14
  }
@@ -7,8 +7,8 @@ import { AbstractError } from "./AbstractError.js";
7
7
  export class PermissionViolationError extends AbstractError {
8
8
  /**
9
9
  * Constructs a new {@linkcode PermissionViolationError}.
10
- * @param message The main error message.
11
- * @param status The HTTP status code to return.
10
+ * @param message - The main error message.
11
+ * @param status - The HTTP status code to return.
12
12
  */
13
13
  constructor(message, status = 403) {
14
14
  super("ERR_OS_PERMISSION_VIOLATION", message, status);
@@ -6,8 +6,8 @@ import { AbstractError } from "./AbstractError.js";
6
6
  export declare class ResourceConflictError extends AbstractError {
7
7
  /**
8
8
  * Constructs a new {@linkcode ResourceConflictError}.
9
- * @param message The main error message.
10
- * @param status The HTTP status code to return.
9
+ * @param message - The main error message.
10
+ * @param status - The HTTP status code to return.
11
11
  */
12
12
  constructor(message: string, status?: number);
13
13
  }
@@ -6,8 +6,8 @@ import { AbstractError } from "./AbstractError.js";
6
6
  export class ResourceConflictError extends AbstractError {
7
7
  /**
8
8
  * Constructs a new {@linkcode ResourceConflictError}.
9
- * @param message The main error message.
10
- * @param status The HTTP status code to return.
9
+ * @param message - The main error message.
10
+ * @param status - The HTTP status code to return.
11
11
  */
12
12
  constructor(message, status = 409) {
13
13
  super("ERR_OS_RESOURCE_CONFLICT", message, status);
@@ -10,8 +10,8 @@ import { AbstractError } from "./AbstractError.js";
10
10
  export declare class UnknownError extends AbstractError {
11
11
  /**
12
12
  * Constructs a new {@linkcode UnknownError}.
13
- * @param message The main error message.
14
- * @param status The HTTP status code to return.
13
+ * @param message - The main error message.
14
+ * @param status - The HTTP status code to return.
15
15
  */
16
16
  constructor(message: string, status?: number);
17
17
  }
@@ -10,8 +10,8 @@ import { AbstractError } from "./AbstractError.js";
10
10
  export class UnknownError extends AbstractError {
11
11
  /**
12
12
  * Constructs a new {@linkcode UnknownError}.
13
- * @param message The main error message.
14
- * @param status The HTTP status code to return.
13
+ * @param message - The main error message.
14
+ * @param status - The HTTP status code to return.
15
15
  */
16
16
  constructor(message, status = 500) {
17
17
  super("ERR_OS_UNKNOWN", message, status);