@oliversalzburg/js-utils 0.0.7 → 0.0.8

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 (56) hide show
  1. package/LICENSES.md +17 -0
  2. package/lib/dom/core.d.ts +12 -0
  3. package/lib/dom/core.js +23 -0
  4. package/lib/dom/core.js.map +1 -0
  5. package/lib/dom/index.d.ts +1 -0
  6. package/lib/dom/index.js +2 -0
  7. package/lib/dom/index.js.map +1 -0
  8. package/lib/error-serializer.js +1 -2
  9. package/lib/error-serializer.js.map +1 -1
  10. package/lib/error-serializer.test.d.ts +1 -0
  11. package/lib/error-serializer.test.js +117 -0
  12. package/lib/error-serializer.test.js.map +1 -0
  13. package/lib/graphics/canvas.d.ts +21 -0
  14. package/lib/graphics/canvas.js +21 -0
  15. package/lib/graphics/canvas.js.map +1 -1
  16. package/lib/graphics/render-loop.d.ts +12 -3
  17. package/lib/graphics/render-loop.js +7 -1
  18. package/lib/graphics/render-loop.js.map +1 -1
  19. package/lib/index.d.ts +1 -0
  20. package/lib/index.js +1 -0
  21. package/lib/index.js.map +1 -1
  22. package/lib/math/core.js +1 -1
  23. package/lib/math/core.js.map +1 -1
  24. package/lib/math/index.d.ts +2 -0
  25. package/lib/math/index.js +2 -0
  26. package/lib/math/index.js.map +1 -1
  27. package/lib/math/vector.d.ts +2 -33
  28. package/lib/math/vector.js +2 -41
  29. package/lib/math/vector.js.map +1 -1
  30. package/lib/math/vector2.d.ts +164 -0
  31. package/lib/math/vector2.js +255 -0
  32. package/lib/math/vector2.js.map +1 -0
  33. package/lib/math/vector3.d.ts +45 -0
  34. package/lib/math/vector3.js +58 -0
  35. package/lib/math/vector3.js.map +1 -0
  36. package/lib/random.d.ts +6 -3
  37. package/lib/random.js +15 -12
  38. package/lib/random.js.map +1 -1
  39. package/package.json +9 -10
  40. package/docs/README.md +0 -3
  41. package/docs/classes/AbstractError.md +0 -271
  42. package/docs/classes/Canvas.md +0 -177
  43. package/docs/classes/InternalError.md +0 -301
  44. package/docs/classes/InvalidArgumentError.md +0 -277
  45. package/docs/classes/InvalidOperationError.md +0 -277
  46. package/docs/classes/NotImplementedError.md +0 -276
  47. package/docs/classes/PermissionViolationError.md +0 -277
  48. package/docs/classes/Random.md +0 -109
  49. package/docs/classes/RenderLoop.md +0 -49
  50. package/docs/classes/ResourceConflictError.md +0 -276
  51. package/docs/classes/UnexpectedNilError.md +0 -169
  52. package/docs/classes/UnknownError.md +0 -280
  53. package/docs/classes/Vector2.md +0 -79
  54. package/docs/classes/Vector3.md +0 -106
  55. package/docs/modules.md +0 -1313
  56. package/typedoc.json +0 -8
@@ -1,169 +0,0 @@
1
- [@oliversalzburg/js-utils](../README.md) / [Exports](../modules.md) / UnexpectedNilError
2
-
3
- # Class: UnexpectedNilError
4
-
5
- Thrown when an unexpected nil value was encountered.
6
-
7
- ## Hierarchy
8
-
9
- - `Error`
10
-
11
- ↳ **`UnexpectedNilError`**
12
-
13
- ## Constructors
14
-
15
- ### constructor
16
-
17
- • **new UnexpectedNilError**(`message?`): [`UnexpectedNilError`](UnexpectedNilError.md)
18
-
19
- Constructs a new {UnexpectedNilError}.
20
-
21
- #### Parameters
22
-
23
- | Name | Type | Default value | Description |
24
- | :-------- | :------- | :----------------------- | :----------------- |
25
- | `message` | `string` | `"unexpected nil value"` | The error message. |
26
-
27
- #### Returns
28
-
29
- [`UnexpectedNilError`](UnexpectedNilError.md)
30
-
31
- #### Overrides
32
-
33
- Error.constructor
34
-
35
- #### Defined in
36
-
37
- [nil.ts:44](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/nil.ts#L44)
38
-
39
- ## Properties
40
-
41
- ### cause
42
-
43
- • `Optional` **cause**: `unknown`
44
-
45
- #### Inherited from
46
-
47
- Error.cause
48
-
49
- #### Defined in
50
-
51
- ../node_modules/typescript/lib/lib.es2022.error.d.ts:24
52
-
53
- ---
54
-
55
- ### message
56
-
57
- • **message**: `string`
58
-
59
- #### Inherited from
60
-
61
- Error.message
62
-
63
- #### Defined in
64
-
65
- ../node_modules/typescript/lib/lib.es5.d.ts:1068
66
-
67
- ---
68
-
69
- ### name
70
-
71
- • **name**: `string`
72
-
73
- #### Inherited from
74
-
75
- Error.name
76
-
77
- #### Defined in
78
-
79
- ../node_modules/typescript/lib/lib.es5.d.ts:1067
80
-
81
- ---
82
-
83
- ### stack
84
-
85
- • `Optional` **stack**: `string`
86
-
87
- #### Inherited from
88
-
89
- Error.stack
90
-
91
- #### Defined in
92
-
93
- ../node_modules/typescript/lib/lib.es5.d.ts:1069
94
-
95
- ---
96
-
97
- ### prepareStackTrace
98
-
99
- ▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any`
100
-
101
- #### Type declaration
102
-
103
- ▸ (`err`, `stackTraces`): `any`
104
-
105
- Optional override for formatting stack traces
106
-
107
- ##### Parameters
108
-
109
- | Name | Type |
110
- | :------------ | :----------- |
111
- | `err` | `Error` |
112
- | `stackTraces` | `CallSite`[] |
113
-
114
- ##### Returns
115
-
116
- `any`
117
-
118
- **`See`**
119
-
120
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
121
-
122
- #### Inherited from
123
-
124
- Error.prepareStackTrace
125
-
126
- #### Defined in
127
-
128
- ../node_modules/@types/node/globals.d.ts:11
129
-
130
- ---
131
-
132
- ### stackTraceLimit
133
-
134
- ▪ `Static` **stackTraceLimit**: `number`
135
-
136
- #### Inherited from
137
-
138
- Error.stackTraceLimit
139
-
140
- #### Defined in
141
-
142
- ../node_modules/@types/node/globals.d.ts:13
143
-
144
- ## Methods
145
-
146
- ### captureStackTrace
147
-
148
- ▸ **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
149
-
150
- Create .stack property on a target object
151
-
152
- #### Parameters
153
-
154
- | Name | Type |
155
- | :---------------- | :--------- |
156
- | `targetObject` | `object` |
157
- | `constructorOpt?` | `Function` |
158
-
159
- #### Returns
160
-
161
- `void`
162
-
163
- #### Inherited from
164
-
165
- Error.captureStackTrace
166
-
167
- #### Defined in
168
-
169
- ../node_modules/@types/node/globals.d.ts:4
@@ -1,280 +0,0 @@
1
- [@oliversalzburg/js-utils](../README.md) / [Exports](../modules.md) / UnknownError
2
-
3
- # Class: UnknownError
4
-
5
- Used when an unknown, non-`Error`-like object was caught and converted into a
6
- real `Error` instance.
7
- Like when you catch a `throw "boom"`, we will convert the caught `"boom"`
8
- into an `UnknownError`.
9
- To enrich an `Error`-like object that was caught, use the [InternalError](InternalError.md).
10
-
11
- ## Hierarchy
12
-
13
- - [`AbstractError`](AbstractError.md)
14
-
15
- ↳ **`UnknownError`**
16
-
17
- ## Constructors
18
-
19
- ### constructor
20
-
21
- • **new UnknownError**(`message`, `status?`): [`UnknownError`](UnknownError.md)
22
-
23
- Constructs a new [UnknownError](UnknownError.md).
24
-
25
- #### Parameters
26
-
27
- | Name | Type | Default value | Description |
28
- | :-------- | :------- | :------------ | :------------------------------ |
29
- | `message` | `string` | `undefined` | The main error message. |
30
- | `status` | `number` | `500` | The HTTP status code to return. |
31
-
32
- #### Returns
33
-
34
- [`UnknownError`](UnknownError.md)
35
-
36
- #### Overrides
37
-
38
- [AbstractError](AbstractError.md).[constructor](AbstractError.md#constructor)
39
-
40
- #### Defined in
41
-
42
- [errors/UnknownError.ts:16](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/errors/UnknownError.ts#L16)
43
-
44
- ## Properties
45
-
46
- ### cause
47
-
48
- • `Optional` **cause**: `unknown`
49
-
50
- #### Inherited from
51
-
52
- [AbstractError](AbstractError.md).[cause](AbstractError.md#cause)
53
-
54
- #### Defined in
55
-
56
- ../node_modules/typescript/lib/lib.es2022.error.d.ts:24
57
-
58
- ---
59
-
60
- ### code
61
-
62
- • **code**: `string`
63
-
64
- An application-unique, readable error code.
65
-
66
- #### Inherited from
67
-
68
- [AbstractError](AbstractError.md).[code](AbstractError.md#code)
69
-
70
- #### Defined in
71
-
72
- [errors/AbstractError.ts:29](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/errors/AbstractError.ts#L29)
73
-
74
- ---
75
-
76
- ### info
77
-
78
- • **info**: [`Maybe`](../modules.md#maybe)\<`string`\>
79
-
80
- A user-friendly error message that may be transported to the client.
81
-
82
- **`Deprecated`**
83
-
84
- User-friendly errors should be read from `extensions`.
85
-
86
- #### Inherited from
87
-
88
- [AbstractError](AbstractError.md).[info](AbstractError.md#info)
89
-
90
- #### Defined in
91
-
92
- [errors/AbstractError.ts:24](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/errors/AbstractError.ts#L24)
93
-
94
- ---
95
-
96
- ### inner
97
-
98
- • **inner**: [`Maybe`](../modules.md#maybe)\<`Error`\>
99
-
100
- Another error that should be transported with this error.
101
-
102
- **`Deprecated`**
103
-
104
- We don't make use of this or interpret nested errors at all.
105
-
106
- #### Inherited from
107
-
108
- [AbstractError](AbstractError.md).[inner](AbstractError.md#inner)
109
-
110
- #### Defined in
111
-
112
- [errors/AbstractError.ts:18](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/errors/AbstractError.ts#L18)
113
-
114
- ---
115
-
116
- ### message
117
-
118
- • **message**: `string`
119
-
120
- #### Inherited from
121
-
122
- [AbstractError](AbstractError.md).[message](AbstractError.md#message)
123
-
124
- #### Defined in
125
-
126
- ../node_modules/typescript/lib/lib.es5.d.ts:1068
127
-
128
- ---
129
-
130
- ### name
131
-
132
- • **name**: `string`
133
-
134
- #### Inherited from
135
-
136
- [AbstractError](AbstractError.md).[name](AbstractError.md#name)
137
-
138
- #### Defined in
139
-
140
- ../node_modules/typescript/lib/lib.es5.d.ts:1067
141
-
142
- ---
143
-
144
- ### stack
145
-
146
- • `Optional` **stack**: `string`
147
-
148
- #### Inherited from
149
-
150
- [AbstractError](AbstractError.md).[stack](AbstractError.md#stack)
151
-
152
- #### Defined in
153
-
154
- ../node_modules/typescript/lib/lib.es5.d.ts:1069
155
-
156
- ---
157
-
158
- ### status
159
-
160
- • **status**: `number`
161
-
162
- The HTTP status code to associate with this error.
163
-
164
- **`Deprecated`**
165
-
166
- We no longer respond to HTTP requests with error-specifc
167
- status codes.
168
-
169
- #### Inherited from
170
-
171
- [AbstractError](AbstractError.md).[status](AbstractError.md#status)
172
-
173
- #### Defined in
174
-
175
- [errors/AbstractError.ts:12](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/errors/AbstractError.ts#L12)
176
-
177
- ---
178
-
179
- ### prepareStackTrace
180
-
181
- ▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any`
182
-
183
- #### Type declaration
184
-
185
- ▸ (`err`, `stackTraces`): `any`
186
-
187
- Optional override for formatting stack traces
188
-
189
- ##### Parameters
190
-
191
- | Name | Type |
192
- | :------------ | :----------- |
193
- | `err` | `Error` |
194
- | `stackTraces` | `CallSite`[] |
195
-
196
- ##### Returns
197
-
198
- `any`
199
-
200
- **`See`**
201
-
202
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
203
-
204
- #### Inherited from
205
-
206
- [AbstractError](AbstractError.md).[prepareStackTrace](AbstractError.md#preparestacktrace)
207
-
208
- #### Defined in
209
-
210
- ../node_modules/@types/node/globals.d.ts:11
211
-
212
- ---
213
-
214
- ### stackTraceLimit
215
-
216
- ▪ `Static` **stackTraceLimit**: `number`
217
-
218
- #### Inherited from
219
-
220
- [AbstractError](AbstractError.md).[stackTraceLimit](AbstractError.md#stacktracelimit)
221
-
222
- #### Defined in
223
-
224
- ../node_modules/@types/node/globals.d.ts:13
225
-
226
- ## Methods
227
-
228
- ### captureStackTrace
229
-
230
- ▸ **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
231
-
232
- Create .stack property on a target object
233
-
234
- #### Parameters
235
-
236
- | Name | Type |
237
- | :---------------- | :--------- |
238
- | `targetObject` | `object` |
239
- | `constructorOpt?` | `Function` |
240
-
241
- #### Returns
242
-
243
- `void`
244
-
245
- #### Inherited from
246
-
247
- [AbstractError](AbstractError.md).[captureStackTrace](AbstractError.md#capturestacktrace)
248
-
249
- #### Defined in
250
-
251
- ../node_modules/@types/node/globals.d.ts:4
252
-
253
- ---
254
-
255
- ### isAbstractError
256
-
257
- ▸ **isAbstractError**(`error`, `allowForeignModule?`): error is AbstractError
258
-
259
- Checks if an object is an instance of [AbstractError](AbstractError.md), or one of its subclasses.
260
-
261
- #### Parameters
262
-
263
- | Name | Type | Default value | Description |
264
- | :------------------- | :-------- | :------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------- |
265
- | `error` | `unknown` | `undefined` | The object to check. |
266
- | `allowForeignModule` | `boolean` | `true` | Only check for similar looking error codes. You're going to want to use this if you're dealing with a setup where multiple versions of js-utils are loaded. |
267
-
268
- #### Returns
269
-
270
- error is AbstractError
271
-
272
- `true` if the object is an [AbstractError](AbstractError.md), `false` otherwise.
273
-
274
- #### Inherited from
275
-
276
- [AbstractError](AbstractError.md).[isAbstractError](AbstractError.md#isabstracterror)
277
-
278
- #### Defined in
279
-
280
- [errors/AbstractError.ts:58](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/errors/AbstractError.ts#L58)
@@ -1,79 +0,0 @@
1
- [@oliversalzburg/js-utils](../README.md) / [Exports](../modules.md) / Vector2
2
-
3
- # Class: Vector2
4
-
5
- A vector with 2 components.
6
-
7
- ## Hierarchy
8
-
9
- - **`Vector2`**
10
-
11
- ↳ [`Vector3`](Vector3.md)
12
-
13
- ## Constructors
14
-
15
- ### constructor
16
-
17
- • **new Vector2**(`x`, `y`): [`Vector2`](Vector2.md)
18
-
19
- Constructs a new [Vector2](Vector2.md).
20
-
21
- #### Parameters
22
-
23
- | Name | Type | Description |
24
- | :--- | :------- | :--------------- |
25
- | `x` | `number` | The X component. |
26
- | `y` | `number` | The Y component. |
27
-
28
- #### Returns
29
-
30
- [`Vector2`](Vector2.md)
31
-
32
- #### Defined in
33
-
34
- [math/vector.ts:13](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L13)
35
-
36
- ## Properties
37
-
38
- ### x
39
-
40
- • **x**: `number`
41
-
42
- #### Defined in
43
-
44
- [math/vector.ts:5](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L5)
45
-
46
- ---
47
-
48
- ### y
49
-
50
- • **y**: `number`
51
-
52
- #### Defined in
53
-
54
- [math/vector.ts:6](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L6)
55
-
56
- ## Methods
57
-
58
- ### dot2
59
-
60
- ▸ **dot2**(`x`, `y`): `number`
61
-
62
- Returns the dot product between the two vectors.
63
-
64
- #### Parameters
65
-
66
- | Name | Type | Description |
67
- | :--- | :------- | :----------------------------------- |
68
- | `x` | `number` | The X component of the other vector. |
69
- | `y` | `number` | The Y component of the other vector. |
70
-
71
- #### Returns
72
-
73
- `number`
74
-
75
- The dot product between the two vectors.
76
-
77
- #### Defined in
78
-
79
- [math/vector.ts:24](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L24)
@@ -1,106 +0,0 @@
1
- [@oliversalzburg/js-utils](../README.md) / [Exports](../modules.md) / Vector3
2
-
3
- # Class: Vector3
4
-
5
- A vector with 3 components.
6
-
7
- ## Hierarchy
8
-
9
- - [`Vector2`](Vector2.md)
10
-
11
- ↳ **`Vector3`**
12
-
13
- ## Constructors
14
-
15
- ### constructor
16
-
17
- • **new Vector3**(`x`, `y`, `z`): [`Vector3`](Vector3.md)
18
-
19
- Constructs a new [Vector3](Vector3.md).
20
-
21
- #### Parameters
22
-
23
- | Name | Type | Description |
24
- | :--- | :------- | :--------------- |
25
- | `x` | `number` | The X component. |
26
- | `y` | `number` | The Y component. |
27
- | `z` | `number` | The Z component. |
28
-
29
- #### Returns
30
-
31
- [`Vector3`](Vector3.md)
32
-
33
- #### Overrides
34
-
35
- [Vector2](Vector2.md).[constructor](Vector2.md#constructor)
36
-
37
- #### Defined in
38
-
39
- [math/vector.ts:41](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L41)
40
-
41
- ## Properties
42
-
43
- ### x
44
-
45
- • **x**: `number`
46
-
47
- #### Inherited from
48
-
49
- [Vector2](Vector2.md).[x](Vector2.md#x)
50
-
51
- #### Defined in
52
-
53
- [math/vector.ts:5](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L5)
54
-
55
- ---
56
-
57
- ### y
58
-
59
- • **y**: `number`
60
-
61
- #### Inherited from
62
-
63
- [Vector2](Vector2.md).[y](Vector2.md#y)
64
-
65
- #### Defined in
66
-
67
- [math/vector.ts:6](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L6)
68
-
69
- ---
70
-
71
- ### z
72
-
73
- • **z**: `number`
74
-
75
- #### Defined in
76
-
77
- [math/vector.ts:33](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L33)
78
-
79
- ## Methods
80
-
81
- ### dot2
82
-
83
- ▸ **dot2**(`x`, `y`): `number`
84
-
85
- Returns the dot product between the two vectors.
86
-
87
- #### Parameters
88
-
89
- | Name | Type | Description |
90
- | :--- | :------- | :----------------------------------- |
91
- | `x` | `number` | The X component of the other vector. |
92
- | `y` | `number` | The Y component of the other vector. |
93
-
94
- #### Returns
95
-
96
- `number`
97
-
98
- The dot product between the two vectors.
99
-
100
- #### Inherited from
101
-
102
- [Vector2](Vector2.md).[dot2](Vector2.md#dot2)
103
-
104
- #### Defined in
105
-
106
- [math/vector.ts:24](https://github.com/oliversalzburg/js-utils/blob/293b24f/source/math/vector.ts#L24)