@jarenjs/core 0.9.2
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.
- package/ARCHITECTURE.md +800 -0
- package/LICENSE +21 -0
- package/README.md +68 -0
- package/dist/types/array.d.ts +28 -0
- package/dist/types/bigint.d.ts +5 -0
- package/dist/types/dates.d.ts +79 -0
- package/dist/types/float.d.ts +32 -0
- package/dist/types/function.d.ts +22 -0
- package/dist/types/index.d.ts +119 -0
- package/dist/types/integer.d.ts +24 -0
- package/dist/types/math/float64.d.ts +121 -0
- package/dist/types/math/index.d.ts +5 -0
- package/dist/types/math/int32.d.ts +41 -0
- package/dist/types/math/vec2f64.d.ts +346 -0
- package/dist/types/math/vec2i32.d.ts +43 -0
- package/dist/types/math/vec3f64.d.ts +61 -0
- package/dist/types/number.d.ts +39 -0
- package/dist/types/object.d.ts +44 -0
- package/dist/types/scan.d.ts +64 -0
- package/dist/types/string.d.ts +65 -0
- package/dist/types/text/base64.d.ts +4 -0
- package/dist/types/text/basic.d.ts +5 -0
- package/dist/types/text/email.d.ts +3 -0
- package/dist/types/text/host.d.ts +14 -0
- package/dist/types/text/i18n.d.ts +13 -0
- package/dist/types/text/identifiers.d.ts +5 -0
- package/dist/types/text/index.d.ts +8 -0
- package/dist/types/text/iregexp.d.ts +36 -0
- package/dist/types/text/misc.d.ts +4 -0
- package/dist/types/text/punycode.d.ts +86 -0
- package/package.json +101 -0
- package/src/array.js +57 -0
- package/src/bigint.js +30 -0
- package/src/dates.js +371 -0
- package/src/float.js +107 -0
- package/src/function.js +56 -0
- package/src/index.js +223 -0
- package/src/integer.js +77 -0
- package/src/math/float64.js +316 -0
- package/src/math/index.js +5 -0
- package/src/math/int32.js +235 -0
- package/src/math/vec2f64.js +706 -0
- package/src/math/vec2i32.js +250 -0
- package/src/math/vec3f64.js +225 -0
- package/src/number.js +63 -0
- package/src/object.js +240 -0
- package/src/scan.js +96 -0
- package/src/string.js +194 -0
- package/src/text/base64.js +54 -0
- package/src/text/basic.js +23 -0
- package/src/text/email.js +61 -0
- package/src/text/host.js +335 -0
- package/src/text/i18n.js +294 -0
- package/src/text/identifiers.js +27 -0
- package/src/text/index.js +11 -0
- package/src/text/iregexp.js +308 -0
- package/src/text/misc.js +19 -0
- package/src/text/punycode.js +407 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
export declare class Vec2f64 {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
constructor(x?: number, y?: number);
|
|
5
|
+
/**
|
|
6
|
+
* Create a new 2 dimensional vector
|
|
7
|
+
* @param {number | Vec2f64} x a floating point number or a Vec2f64 instance
|
|
8
|
+
* @param {number | undefined} y a fl
|
|
9
|
+
* @returns {Vec2f64} a new vector structure
|
|
10
|
+
*/
|
|
11
|
+
static new(x?: number | Vec2f64, y?: number | undefined): Vec2f64;
|
|
12
|
+
static neg(v?: Readonly<Vec2f64>): Vec2f64;
|
|
13
|
+
static add(a?: Readonly<Vec2f64>, b?: Readonly<Vec2f64>): Vec2f64;
|
|
14
|
+
static adds(v?: Readonly<Vec2f64>, scalar?: number): Vec2f64;
|
|
15
|
+
static addms(a?: Readonly<Vec2f64>, b?: Readonly<Vec2f64>, scalar?: number): Vec2f64;
|
|
16
|
+
static sub(a?: Readonly<Vec2f64>, b?: Readonly<Vec2f64>): Vec2f64;
|
|
17
|
+
static subs(v?: Readonly<Vec2f64>, scalar?: number): Vec2f64;
|
|
18
|
+
static mul(a?: Readonly<Vec2f64>, b?: Readonly<Vec2f64>): Vec2f64;
|
|
19
|
+
static muls(v?: Readonly<Vec2f64>, scalar?: number): Vec2f64;
|
|
20
|
+
static div(a?: Readonly<Vec2f64>, b?: Readonly<Vec2f64>): Vec2f64;
|
|
21
|
+
static divs(v?: Readonly<Vec2f64>, scalar?: number): Vec2f64;
|
|
22
|
+
static inv(v?: Readonly<Vec2f64>): Vec2f64;
|
|
23
|
+
static ceil(v?: Readonly<Vec2f64>): Vec2f64;
|
|
24
|
+
static floor(v?: Readonly<Vec2f64>): Vec2f64;
|
|
25
|
+
static round(v?: Readonly<Vec2f64>): Vec2f64;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the minimum of two vectors
|
|
28
|
+
* @param {Vec2f64} a the base vector
|
|
29
|
+
* @param {Vec2f64} b the target vector
|
|
30
|
+
* @returns {Vec2f64} the new minimum of two vectors
|
|
31
|
+
*/
|
|
32
|
+
static min(a?: Vec2f64, b?: Vec2f64): Vec2f64;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the maximum of two vectors
|
|
35
|
+
* @param {Vec2f64} a the base vector
|
|
36
|
+
* @param {Vec2f64} b the target vector
|
|
37
|
+
* @returns {Vec2f64} the new maximum of two vectors
|
|
38
|
+
*/
|
|
39
|
+
static max(a?: Vec2f64, b?: Vec2f64): Vec2f64;
|
|
40
|
+
/**
|
|
41
|
+
* Returns true if two vectors are strictly equal
|
|
42
|
+
* @param {Vec2f64} a the base vector
|
|
43
|
+
* @param {Vec2f64} b the target vector
|
|
44
|
+
* @returns {boolean} true if two vectors are strictly equal
|
|
45
|
+
*/
|
|
46
|
+
static eqstrict(a?: Vec2f64, b?: Vec2f64): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Returns true if two vectors are equal within a small epsilon
|
|
49
|
+
* @param {Vec2f64} a the base vector
|
|
50
|
+
* @param {Vec2f64} b the target vector
|
|
51
|
+
* @returns {boolean} true if two vectors are equal within a small epsilon
|
|
52
|
+
*/
|
|
53
|
+
static equals(a?: Vec2f64, b?: Vec2f64): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the square of the magnitude of the vector
|
|
56
|
+
* @param {Vec2f64} v the vector
|
|
57
|
+
* @returns {number} the square of the magnitude of the vector
|
|
58
|
+
*/
|
|
59
|
+
static mag2(v?: Vec2f64): number;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the magnitude of the vector
|
|
62
|
+
* @param {Vec2f64} v the vector
|
|
63
|
+
* @returns {number} the magnitude of the vector
|
|
64
|
+
*/
|
|
65
|
+
static mag(v?: Vec2f64): number;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the square of the distance between two vectors
|
|
68
|
+
* @param {Vec2f64} a the base vector
|
|
69
|
+
* @param {Vec2f64} b the target vector
|
|
70
|
+
* @returns {number} the square of the distance between two vectors
|
|
71
|
+
*/
|
|
72
|
+
static dist2(a?: Vec2f64, b?: Vec2f64): number;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the distance between two vectors
|
|
75
|
+
* @param {Vec2f64} a the base vector
|
|
76
|
+
* @param {Vec2f64} b the target vector
|
|
77
|
+
* @returns {number} the distance between two vectors
|
|
78
|
+
*/
|
|
79
|
+
static dist(a?: Vec2f64, b?: Vec2f64): number;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the dot product of two vectors
|
|
82
|
+
* @param {Vec2f64} a the base vector
|
|
83
|
+
* @param {Vec2f64} b the target vector
|
|
84
|
+
* @returns {number} the dot product of two vectors
|
|
85
|
+
*/
|
|
86
|
+
static dot(a?: Vec2f64, b?: Vec2f64): number;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the cross-product of two vectors
|
|
89
|
+
* @param {Vec2f64} a the base vector
|
|
90
|
+
* @param {Vec2f64} b the target vector
|
|
91
|
+
* @returns {number} the cross-product of two vectors
|
|
92
|
+
*/
|
|
93
|
+
static cross(a?: Vec2f64, b?: Vec2f64): number;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the cross-product of three vectors
|
|
96
|
+
*
|
|
97
|
+
* You can determine which side of a line a point is on
|
|
98
|
+
* by converting the line to hyperplane form (implicitly
|
|
99
|
+
* or explicitly) and then computing the perpendicular
|
|
100
|
+
* (pseudo)distance from the point to the hyperplane.
|
|
101
|
+
*
|
|
102
|
+
* With the cross-product of two vectors A and B being the vector
|
|
103
|
+
*
|
|
104
|
+
* AxB = (AyBz − AzBy, AzBx − AxBz, AxBy − AyBx)
|
|
105
|
+
* with Az and Bz being zero you are left with the third component of that vector
|
|
106
|
+
*
|
|
107
|
+
* AxBy - AyBx
|
|
108
|
+
*
|
|
109
|
+
* With A being the vector from point a to b, and B being the vector from point a to c means
|
|
110
|
+
*
|
|
111
|
+
* Ax = (b[x]-a[x])
|
|
112
|
+
* Ay = (b[y]-a[y])
|
|
113
|
+
* Bx = (c[x]-a[x])
|
|
114
|
+
* By = (c[y]-a[y])
|
|
115
|
+
*
|
|
116
|
+
* giving
|
|
117
|
+
*
|
|
118
|
+
* AxBy - AyBx = (b[x]-a[x])*(c[y]-a[y])-(b[y]-a[y])*(c[x]-a[x])
|
|
119
|
+
*
|
|
120
|
+
* which is a scalar, the sign of that scalar will tell you wether point c
|
|
121
|
+
* lies to the left or right of vector ab
|
|
122
|
+
*
|
|
123
|
+
* @param {Vec2f64} a the base vector
|
|
124
|
+
* @param {Vec2f64} b the pivot vector
|
|
125
|
+
* @param {Vec2f64} c the target vector
|
|
126
|
+
* @returns {number} the cross-product of three vectors
|
|
127
|
+
*/
|
|
128
|
+
static cross3(a?: Vec2f64, b?: Vec2f64, c?: Vec2f64): number;
|
|
129
|
+
/**
|
|
130
|
+
* Returns the angle in radians of its vector
|
|
131
|
+
* @param {Vec2f64} v the base vector
|
|
132
|
+
* @returns {number} the angle in radians of its vector
|
|
133
|
+
*/
|
|
134
|
+
static theta(v?: Vec2f64): number;
|
|
135
|
+
/**
|
|
136
|
+
* Returns the angle in radians of its vector
|
|
137
|
+
* @param {Vec2f64} v the base vector
|
|
138
|
+
* @returns {number} the angle in radians of its vector
|
|
139
|
+
*/
|
|
140
|
+
static phi(v?: Vec2f64): number;
|
|
141
|
+
/**
|
|
142
|
+
* Returns the unit vector of its vector
|
|
143
|
+
* @param {Vec2f64} v the base vector
|
|
144
|
+
* @returns {Vec2f64} the new unit vector of its vector
|
|
145
|
+
*/
|
|
146
|
+
static unit(v?: Vec2f64): Vec2f64;
|
|
147
|
+
/**
|
|
148
|
+
* Returns the vector rotated 90 degrees counter-clockwise
|
|
149
|
+
* @param {Vec2f64} v the base vector
|
|
150
|
+
* @returns {Vec2f64} the new vector rotated 90 degrees counter-clockwise
|
|
151
|
+
*/
|
|
152
|
+
static rotn90(v?: Vec2f64): Vec2f64;
|
|
153
|
+
/**
|
|
154
|
+
* Returns the vector rotated 90 degrees clockwise
|
|
155
|
+
* @param {Vec2f64} v the base vector
|
|
156
|
+
* @returns {Vec2f64} the new vector rotated 90 degrees clockwise
|
|
157
|
+
*/
|
|
158
|
+
static rot90(v?: Vec2f64): Vec2f64;
|
|
159
|
+
/**
|
|
160
|
+
* Rotates a vector by the specified angle in radians
|
|
161
|
+
* @param {Vec2f64} v the base vector
|
|
162
|
+
* @param {number} radians the angle in radians
|
|
163
|
+
* @returns {Vec2f64} transformed output vector
|
|
164
|
+
*/
|
|
165
|
+
static rotate(v?: Vec2f64, radians?: number): Vec2f64;
|
|
166
|
+
/**
|
|
167
|
+
* Rotates a vector by the specified angle in radians about a specified vector
|
|
168
|
+
* @param {Vec2f64} a the base vector to rotate
|
|
169
|
+
* @param {Vec2f64} b the pivot vector to rotate about
|
|
170
|
+
* @param {number} radians the angle in radians
|
|
171
|
+
* @returns {Vec2f64} the new transformed output vector
|
|
172
|
+
*/
|
|
173
|
+
static about(a?: Vec2f64, b?: Vec2f64, radians?: number): Vec2f64;
|
|
174
|
+
/**
|
|
175
|
+
* Linearly interpolates between two vectors
|
|
176
|
+
* @param {number} norm the interpolation factor
|
|
177
|
+
* @param {Vec2f64} a the base vector
|
|
178
|
+
* @param {Vec2f64} b the target vector
|
|
179
|
+
* @returns {Vec2f64} the new interpolated vector
|
|
180
|
+
*/
|
|
181
|
+
static lerp(norm?: number, a?: Vec2f64, b?: Vec2f64): Vec2f64;
|
|
182
|
+
/**
|
|
183
|
+
* Negates the vector in place
|
|
184
|
+
* @returns {Vec2f64} the negated vector
|
|
185
|
+
*/
|
|
186
|
+
ineg(): Vec2f64;
|
|
187
|
+
/**
|
|
188
|
+
* Adds a vector to the vector in place
|
|
189
|
+
* @param {Vec2f64} v the target vector
|
|
190
|
+
* @returns {Vec2f64} the sum of the vectors
|
|
191
|
+
*/
|
|
192
|
+
iadd(v?: Vec2f64): Vec2f64;
|
|
193
|
+
/**
|
|
194
|
+
* Adds a scalar to the vector in place
|
|
195
|
+
* @param {number} scalar
|
|
196
|
+
* @returns {Vec2f64} the vector with the scalar added
|
|
197
|
+
*/
|
|
198
|
+
iadds(scalar?: number): Vec2f64;
|
|
199
|
+
/**
|
|
200
|
+
* Adds a vector scaled by a scalar to the vector in place
|
|
201
|
+
* @param {Vec2f64} v the target vector
|
|
202
|
+
* @param {number} scalar
|
|
203
|
+
* @returns {Vec2f64} the vector with the vector scaled by the scalar added
|
|
204
|
+
*/
|
|
205
|
+
iaddms(v?: Vec2f64, scalar?: number): Vec2f64;
|
|
206
|
+
/**
|
|
207
|
+
* Subtracts a vector from the vector in place
|
|
208
|
+
* @param {Vec2f64} v the target vector
|
|
209
|
+
* @returns {Vec2f64} the difference of the vectors
|
|
210
|
+
*/
|
|
211
|
+
isub(v?: Vec2f64): Vec2f64;
|
|
212
|
+
/**
|
|
213
|
+
* Subtracts a scalar from the vector in place
|
|
214
|
+
* @param {number} scalar
|
|
215
|
+
* @returns {Vec2f64} the vector with the scalar subtracted
|
|
216
|
+
*/
|
|
217
|
+
isubs(scalar?: number): Vec2f64;
|
|
218
|
+
/**
|
|
219
|
+
* Multiplies the vector by a vector in place
|
|
220
|
+
* @param {Vec2f64} v the target vector
|
|
221
|
+
* @returns {Vec2f64} the product of the vectors
|
|
222
|
+
*/
|
|
223
|
+
imul(v?: Vec2f64): Vec2f64;
|
|
224
|
+
/**
|
|
225
|
+
* Multiplies the vector by a scalar in place
|
|
226
|
+
* @param {number} scalar
|
|
227
|
+
* @returns {Vec2f64} the vector with the scalar multiplied
|
|
228
|
+
*/
|
|
229
|
+
imuls(scalar?: number): Vec2f64;
|
|
230
|
+
/**
|
|
231
|
+
* Divides the vector by a vector in place
|
|
232
|
+
* @param {Vec2f64} v the target vector
|
|
233
|
+
* @returns {Vec2f64} the quotient of the vectors
|
|
234
|
+
*/
|
|
235
|
+
idiv(v?: Vec2f64): Vec2f64;
|
|
236
|
+
/**
|
|
237
|
+
* Divides a vector by a scalar in place
|
|
238
|
+
* @param {number} scalar
|
|
239
|
+
* @returns {Vec2f64} the vector with the scalar divided
|
|
240
|
+
*/
|
|
241
|
+
idivs(scalar?: number): Vec2f64;
|
|
242
|
+
/**
|
|
243
|
+
* Inverts the vector in place
|
|
244
|
+
* @returns {Vec2f64} the inverted vector
|
|
245
|
+
*/
|
|
246
|
+
iinv(): Vec2f64;
|
|
247
|
+
/**
|
|
248
|
+
* Rounds the vector in place
|
|
249
|
+
* @returns {Vec2f64} the rounded vector
|
|
250
|
+
*/
|
|
251
|
+
iceil(): Vec2f64;
|
|
252
|
+
/**
|
|
253
|
+
* Floors the vector in place
|
|
254
|
+
* @returns {Vec2f64} the floored vector
|
|
255
|
+
*/
|
|
256
|
+
ifloor(): Vec2f64;
|
|
257
|
+
/**
|
|
258
|
+
* Rounds the vector in place
|
|
259
|
+
* @returns {Vec2f64} the rounded vector
|
|
260
|
+
*/
|
|
261
|
+
iround(): Vec2f64;
|
|
262
|
+
/**
|
|
263
|
+
* Returns the minimum of two vectors in place
|
|
264
|
+
* @param {Vec2f64} v the target vector
|
|
265
|
+
* @returns {Vec2f64} the minimum of two vectors
|
|
266
|
+
*/
|
|
267
|
+
imin(v?: Vec2f64): Vec2f64;
|
|
268
|
+
/**
|
|
269
|
+
* Returns the maximum of two vectors in place
|
|
270
|
+
* @param {Vec2f64} v the target vector
|
|
271
|
+
* @returns {Vec2f64} the maximum of two vectors
|
|
272
|
+
*/
|
|
273
|
+
imax(v?: Vec2f64): Vec2f64;
|
|
274
|
+
/**
|
|
275
|
+
* Returns the square of the magnitude of the vector
|
|
276
|
+
* @returns {number} the square of the magnitude of the vector
|
|
277
|
+
*/
|
|
278
|
+
mag2(): number;
|
|
279
|
+
/**
|
|
280
|
+
* Returns the magnitude of the vector
|
|
281
|
+
* @returns {number} the magnitude of the vector
|
|
282
|
+
*/
|
|
283
|
+
mag(): number;
|
|
284
|
+
/**
|
|
285
|
+
* Returns the angle in radians of its vector
|
|
286
|
+
* @returns {number} the angle in radians of its vector
|
|
287
|
+
*/
|
|
288
|
+
phi(): number;
|
|
289
|
+
/**
|
|
290
|
+
* Returns the dot product of this vector and the target vector
|
|
291
|
+
* @param {Vec2f64} v the target vector
|
|
292
|
+
* @returns {number} the dot product of two vectors
|
|
293
|
+
*/
|
|
294
|
+
dot(v?: Vec2f64): number;
|
|
295
|
+
/**
|
|
296
|
+
* Returns the cross-product of this vector and the target vector
|
|
297
|
+
* @param {Vec2f64} v the target vector
|
|
298
|
+
* @returns {number} The cross product of two vectors
|
|
299
|
+
*/
|
|
300
|
+
cross(v?: Vec2f64): number;
|
|
301
|
+
/**
|
|
302
|
+
* Returns the cross-product of three vectors
|
|
303
|
+
* @param {Vec2f64} a B
|
|
304
|
+
* @param {Vec2f64} b C
|
|
305
|
+
* @returns {number} The cross product of three vectors
|
|
306
|
+
*
|
|
307
|
+
*/
|
|
308
|
+
cross3(a?: Vec2f64, b?: Vec2f64): number;
|
|
309
|
+
/**
|
|
310
|
+
* Returns the angle in radians of its vector
|
|
311
|
+
*
|
|
312
|
+
* Math.atan2(dy, dx) === Math.asin(dy/Math.sqrt(dx*dx + dy*dy))
|
|
313
|
+
*
|
|
314
|
+
* @returns {number} the angle in radians of its vector
|
|
315
|
+
*/
|
|
316
|
+
theta(): number;
|
|
317
|
+
/**
|
|
318
|
+
* Returns the unit vector of its vector in place
|
|
319
|
+
* @returns {Vec2f64} the unit vector of its vector
|
|
320
|
+
*/
|
|
321
|
+
iunit(): Vec2f64;
|
|
322
|
+
/**
|
|
323
|
+
* Rotates a vector 90 degrees counter-clockwise in place
|
|
324
|
+
* @returns {Vec2f64} the vector rotated 90 degrees counter-clockwise
|
|
325
|
+
*/
|
|
326
|
+
irotn90(): Vec2f64;
|
|
327
|
+
/**
|
|
328
|
+
* Rotates a vector 90 degrees clockwise in place
|
|
329
|
+
* @returns {Vec2f64} the vector rotated 90 degrees clockwise
|
|
330
|
+
*/
|
|
331
|
+
irot90(): Vec2f64;
|
|
332
|
+
/**
|
|
333
|
+
* Rotates a vector by the specified angle in radians in place
|
|
334
|
+
* @param {number} radians angle in radians
|
|
335
|
+
* @returns {Vec2f64} transformed output vector
|
|
336
|
+
*/
|
|
337
|
+
irotate(radians?: number): Vec2f64;
|
|
338
|
+
/**
|
|
339
|
+
* Rotates a vector by the specified angle in radians about a specified vector in place
|
|
340
|
+
* @param {Vec2f64} v the pivot vector
|
|
341
|
+
* @param {number} radians the angle in radians to rotate by
|
|
342
|
+
* @returns {Vec2f64} transformed output vector
|
|
343
|
+
*/
|
|
344
|
+
iabout(v?: Vec2f64, radians?: number): Vec2f64;
|
|
345
|
+
}
|
|
346
|
+
export declare const def_Vec2f64: Readonly<Vec2f64>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare class Vec2i32 {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
/**
|
|
5
|
+
* @param {number | undefined} x
|
|
6
|
+
* @param {number | undefined} y
|
|
7
|
+
*/
|
|
8
|
+
constructor(x?: number | undefined, y?: number | undefined);
|
|
9
|
+
static new(x?: number, y?: number): Vec2i32;
|
|
10
|
+
new(): Vec2i32;
|
|
11
|
+
static neg(v?: Readonly<Vec2i32>): Vec2i32;
|
|
12
|
+
static add(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>): Vec2i32;
|
|
13
|
+
static adds(v?: Readonly<Vec2i32>, scalar?: number): Vec2i32;
|
|
14
|
+
static sub(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>): Vec2i32;
|
|
15
|
+
static subs(a?: Readonly<Vec2i32>, scalar?: number): Vec2i32;
|
|
16
|
+
static mul(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>): Vec2i32;
|
|
17
|
+
static muls(v?: Readonly<Vec2i32>, scalar?: number): Vec2i32;
|
|
18
|
+
static div(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>): Vec2i32;
|
|
19
|
+
static divs(v?: Readonly<Vec2i32>, scalar?: number): Vec2i32;
|
|
20
|
+
static mag2(v?: Readonly<Vec2i32>): number;
|
|
21
|
+
static mag(v?: Readonly<Vec2i32>): number;
|
|
22
|
+
static dot(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>): number;
|
|
23
|
+
static cross(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>): number;
|
|
24
|
+
static cross3(a?: Readonly<Vec2i32>, b?: Readonly<Vec2i32>, c?: Readonly<Vec2i32>): number;
|
|
25
|
+
static thetaEx(v?: Readonly<Vec2i32>): number;
|
|
26
|
+
static phiEx(v?: Readonly<Vec2i32>): number;
|
|
27
|
+
static norm(v?: Readonly<Vec2i32>): Vec2i32;
|
|
28
|
+
static rotn90(v?: Readonly<Vec2i32>): Vec2i32;
|
|
29
|
+
static rot90(v?: Readonly<Vec2i32>): Vec2i32;
|
|
30
|
+
ineg(): this;
|
|
31
|
+
iadd(v?: Readonly<Vec2i32>): this;
|
|
32
|
+
iadds(scalar?: number): this;
|
|
33
|
+
isub(v?: Readonly<Vec2i32>): this;
|
|
34
|
+
isubs(scalar?: number): this;
|
|
35
|
+
imul(v?: Readonly<Vec2i32>): this;
|
|
36
|
+
imuls(scalar?: number): this;
|
|
37
|
+
idiv(v?: Readonly<Vec2i32>): this;
|
|
38
|
+
idivs(scalar?: number): this;
|
|
39
|
+
inorm(): this;
|
|
40
|
+
irotn90(): this;
|
|
41
|
+
irot90(): this;
|
|
42
|
+
}
|
|
43
|
+
export declare const def_Vec2i32: Readonly<Vec2i32>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Vec2f64 } from './vec2f64.js';
|
|
2
|
+
/**
|
|
3
|
+
* @class Vec3f64
|
|
4
|
+
* @classdesc A 3-dimensional vector of float64 values
|
|
5
|
+
* @property {double} x - The x component of the vector
|
|
6
|
+
* @property {double} y - The y component of the vector
|
|
7
|
+
* @property {double} z - The z component of the vector
|
|
8
|
+
*/
|
|
9
|
+
export declare class Vec3f64 {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
constructor(x?: number, y?: number, z?: number);
|
|
14
|
+
/**
|
|
15
|
+
* Create a new 3 dimensional vector
|
|
16
|
+
* @param {number | Vec3f64 | Vec2f64} x a floating point number or a Vec3f64 instance or a vec2f64 instance
|
|
17
|
+
* @param {number | undefined} y a floating point number
|
|
18
|
+
* @param {number | undefined} z a floating point number
|
|
19
|
+
* @returns {Vec3f64} a new vector structure
|
|
20
|
+
*/
|
|
21
|
+
static new(x?: number | Vec3f64 | Vec2f64, y?: number | undefined, z?: number | undefined): Vec3f64;
|
|
22
|
+
static add(a?: Readonly<Vec3f64>, b?: Readonly<Vec3f64>): Vec3f64;
|
|
23
|
+
static adds(a?: Readonly<Vec3f64>, scalar?: number): Vec3f64;
|
|
24
|
+
static sub(a?: Readonly<Vec3f64>, b?: Readonly<Vec3f64>): Vec3f64;
|
|
25
|
+
static subs(a?: Readonly<Vec3f64>, scalar?: number): Vec3f64;
|
|
26
|
+
static div(a?: Readonly<Vec3f64>, b?: Readonly<Vec3f64>): Vec3f64;
|
|
27
|
+
static divs(v?: Readonly<Vec3f64>, scalar?: number): Vec3f64;
|
|
28
|
+
static mul(a?: Readonly<Vec3f64>, b?: Readonly<Vec3f64>): Vec3f64;
|
|
29
|
+
static muls(v?: Readonly<Vec3f64>, scalar?: number): Vec3f64;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the dot product of two 3d vectors
|
|
32
|
+
* @param {Vec3f64} a the base vector
|
|
33
|
+
* @param {Vec3f64} b the target vector
|
|
34
|
+
* @returns {number} the dot product of two vectors
|
|
35
|
+
*/
|
|
36
|
+
static dot(a?: Vec3f64, b?: Vec3f64): number;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the cross product of two 3d vectors
|
|
39
|
+
* @param {Vec3f64} a the base vector
|
|
40
|
+
* @param {Vec3f64} b the target vector
|
|
41
|
+
* @returns {Vec3f64} the cross product of two vectors
|
|
42
|
+
*/
|
|
43
|
+
static cross(a?: Vec3f64, b?: Vec3f64): Vec3f64;
|
|
44
|
+
static mag2(v?: Readonly<Vec3f64>): number;
|
|
45
|
+
static mag(v?: Readonly<Vec3f64>): number;
|
|
46
|
+
static unit(v?: Readonly<Vec3f64>): Vec3f64;
|
|
47
|
+
iadd(v?: Readonly<Vec3f64>): this;
|
|
48
|
+
iadds(scalar?: number): this;
|
|
49
|
+
isub(v?: Readonly<Vec3f64>): this;
|
|
50
|
+
isubs(scalar?: number): this;
|
|
51
|
+
idiv(v?: Readonly<Vec3f64>): this;
|
|
52
|
+
idivs(scalar?: number): this;
|
|
53
|
+
imul(v?: Readonly<Vec3f64>): this;
|
|
54
|
+
imuls(scalar?: number): this;
|
|
55
|
+
dot(v?: Readonly<Vec3f64>): number;
|
|
56
|
+
icross(v?: Readonly<Vec3f64>): this;
|
|
57
|
+
mag2(): number;
|
|
58
|
+
mag(): number;
|
|
59
|
+
iunit(): this;
|
|
60
|
+
}
|
|
61
|
+
export declare const def_Vec3f64: Readonly<Vec3f64>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given data is of boolean type or boolean-like (the strings 'true' or 'false').
|
|
3
|
+
* @param {any} data - The data to check.
|
|
4
|
+
* @returns {boolean} - True if the data is boolean or boolean-like, otherwise false.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isBoolishType(data: any): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the given object is a boolean type or a boolean-like string ('true' or 'false') and returns it, otherwise returns the default value.
|
|
9
|
+
* @param {any} obj - The object to check.
|
|
10
|
+
* @param {boolean|undefined} [def=undefined] - The default value to return if the object is not a boolean or boolean-like string.
|
|
11
|
+
* @returns {boolean|undefined} - The boolean/boolean-like value or the default value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getBoolishType(obj: any, def?: boolean | undefined): boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the given data is number-like (can be converted to a number).
|
|
16
|
+
* @param {any} data - The data to check.
|
|
17
|
+
* @returns {boolean} - True if the data is number-like, otherwise false.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isNumbishType(data: any): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the given data is an integer-like type.
|
|
22
|
+
* @param {any} data - The data to check.
|
|
23
|
+
* @returns {boolean} - True if the data is an integer-like type, otherwise false.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isIntishType(data: any): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the given object is a number-like type and returns it as a number, otherwise returns the default value.
|
|
28
|
+
* @param {any} obj - The object to check.
|
|
29
|
+
* @param {number|undefined} [def=undefined] - The default value to return if the object is not a number-like type.
|
|
30
|
+
* @returns {number|undefined} - The number value or the default value.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getNumbishType(obj: any, def?: number | undefined): number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the given object is an integer-like type and returns it as a number, otherwise returns the default value.
|
|
35
|
+
* @param {any} obj - The object to check.
|
|
36
|
+
* @param {number|undefined} [def=undefined] - The default value to return if the object is not an integer-like type.
|
|
37
|
+
* @returns {number|undefined} - The integer value or the default value.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getIntishType(obj: any, def?: number | undefined): number | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep equality comparison for arbitrary values.
|
|
3
|
+
*
|
|
4
|
+
* Generic JavaScript equality: understands Maps, Sets, RegExps,
|
|
5
|
+
* functions, typed arrays and class instances (constructors must
|
|
6
|
+
* match). Not the same as `equalsJson`, which compares JSON values
|
|
7
|
+
* only and is the hot-path variant — keep both.
|
|
8
|
+
* @param {any} target
|
|
9
|
+
* @param {any} source
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export declare function equalsDeep(target: any, source: any): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Structural equality of two JSON values per RFC 9535 section 2.3.5.2.2.
|
|
15
|
+
*
|
|
16
|
+
* JSON-only equality: objects compare by own enumerable keys, arrays by
|
|
17
|
+
* index, primitives by `===` (so `1 === 1.0`, and `NaN` is never equal).
|
|
18
|
+
* Anything a JSON value cannot be — Map, Set, RegExp, function, class
|
|
19
|
+
* instance — compares by identity only. Deliberately not the same as
|
|
20
|
+
* `equalsDeep`, the generic JavaScript variant: this is the hot-path
|
|
21
|
+
* comparator of the JSONPath engine — do not merge the two.
|
|
22
|
+
* @param {any} a
|
|
23
|
+
* @param {any} b
|
|
24
|
+
* @returns {boolean}
|
|
25
|
+
*/
|
|
26
|
+
export declare function equalsJson(a: any, b: any): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if all items in an array are unique using deep equality
|
|
29
|
+
* @param {any[]} arr - The array to check
|
|
30
|
+
* @returns {boolean} True if all items are unique
|
|
31
|
+
*/
|
|
32
|
+
export declare function isUniqueDeepArray(arr: any[]): boolean;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {Map<any, any>} map
|
|
36
|
+
* @param {...Map<any, any>} iterables
|
|
37
|
+
*/
|
|
38
|
+
export declare function mergeMap(map: Map<any, any>, ...iterables: Map<any, any>[]): void;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {Set<any>} set
|
|
42
|
+
* @param {...Array<Set<any>>} iterables
|
|
43
|
+
*/
|
|
44
|
+
export declare function mergeSet(set: Set<any>, ...iterables: Array<Set<any>>[]): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const CC_TAB = 9;
|
|
2
|
+
export declare const CC_LF = 10;
|
|
3
|
+
export declare const CC_CR = 13;
|
|
4
|
+
export declare const CC_SPACE = 32;
|
|
5
|
+
export declare const CC_BANG = 33;
|
|
6
|
+
export declare const CC_DQUOTE = 34;
|
|
7
|
+
export declare const CC_HASH = 35;
|
|
8
|
+
export declare const CC_DOLLAR = 36;
|
|
9
|
+
export declare const CC_PERCENT = 37;
|
|
10
|
+
export declare const CC_AMP = 38;
|
|
11
|
+
export declare const CC_SQUOTE = 39;
|
|
12
|
+
export declare const CC_LPAREN = 40;
|
|
13
|
+
export declare const CC_RPAREN = 41;
|
|
14
|
+
export declare const CC_STAR = 42;
|
|
15
|
+
export declare const CC_COMMA = 44;
|
|
16
|
+
export declare const CC_MINUS = 45;
|
|
17
|
+
export declare const CC_DOT = 46;
|
|
18
|
+
export declare const CC_SLASH = 47;
|
|
19
|
+
export declare const CC_0 = 48;
|
|
20
|
+
export declare const CC_1 = 49;
|
|
21
|
+
export declare const CC_9 = 57;
|
|
22
|
+
export declare const CC_COLON = 58;
|
|
23
|
+
export declare const CC_LT = 60;
|
|
24
|
+
export declare const CC_EQ = 61;
|
|
25
|
+
export declare const CC_GT = 62;
|
|
26
|
+
export declare const CC_QUESTION = 63;
|
|
27
|
+
export declare const CC_AT = 64;
|
|
28
|
+
export declare const CC_LBRACKET = 91;
|
|
29
|
+
export declare const CC_BACKSLASH = 92;
|
|
30
|
+
export declare const CC_RBRACKET = 93;
|
|
31
|
+
export declare const CC_UNDERSCORE = 95;
|
|
32
|
+
export declare const CC_PIPE = 124;
|
|
33
|
+
export declare const CC_TILDE = 126;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a char code is an ASCII digit (0-9).
|
|
36
|
+
* @param {number} c - The char code
|
|
37
|
+
* @returns {boolean}
|
|
38
|
+
*/
|
|
39
|
+
export declare function isDigitCode(c: number): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if a char code is an ASCII hexadecimal digit (0-9, A-F, a-f).
|
|
42
|
+
* @param {number} c - The char code
|
|
43
|
+
* @returns {boolean}
|
|
44
|
+
*/
|
|
45
|
+
export declare function isHexDigitCode(c: number): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a char code is blank space per RFC 9535 (space, tab,
|
|
48
|
+
* line feed or carriage return).
|
|
49
|
+
* @param {number} c - The char code
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
export declare function isWhitespaceCode(c: number): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a char code is an ASCII lowercase letter (a-z).
|
|
55
|
+
* @param {number} c - The char code
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
export declare function isAsciiLowerCode(c: number): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Checks if a char code is an ASCII uppercase letter (A-Z).
|
|
61
|
+
* @param {number} c - The char code
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
export declare function isAsciiUpperCode(c: number): boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string | null | undefined} data
|
|
3
|
+
* @returns {boolean}
|
|
4
|
+
*/
|
|
5
|
+
export declare function isStringEmpty(data: string | null | undefined): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* @param {string | null | undefined} data
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export declare function isStringWhiteSpace(data: string | null | undefined): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} str
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
export declare function isStringUpperCase(str: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} str
|
|
18
|
+
* @returns {boolean}
|
|
19
|
+
*/
|
|
20
|
+
export declare function isStringLowerCase(str: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @param {unknown} data
|
|
23
|
+
* @returns {data is RegExp}
|
|
24
|
+
*/
|
|
25
|
+
export declare function isRegExpType(data: unknown): data is RegExp;
|
|
26
|
+
/**
|
|
27
|
+
* @param {string | RegExp | null | undefined } data
|
|
28
|
+
* @returns {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export declare function isStringRegExp(data: string | RegExp | null | undefined): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @param {string | RegExp | null | undefined } pattern
|
|
33
|
+
* @returns {RegExp | undefined}
|
|
34
|
+
*/
|
|
35
|
+
export declare function createRegExp(pattern: string | RegExp | null | undefined): RegExp | undefined;
|
|
36
|
+
export declare function getSegmenter(): Intl.Segmenter;
|
|
37
|
+
/**
|
|
38
|
+
* @param {string} str
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
export declare function isAsciiString(str: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @param {string} str
|
|
44
|
+
* @param {boolean} [useGrapheme=false]
|
|
45
|
+
* @returns {number}
|
|
46
|
+
*/
|
|
47
|
+
export declare function getStringLength(str: string, useGrapheme?: boolean): number;
|
|
48
|
+
/**
|
|
49
|
+
* Count the Unicode code points of a string (surrogate-pair aware;
|
|
50
|
+
* a lone surrogate counts as one code point).
|
|
51
|
+
* @param {string} str
|
|
52
|
+
* @returns {number}
|
|
53
|
+
*/
|
|
54
|
+
export declare function countCodePoints(str: string): number;
|
|
55
|
+
/**
|
|
56
|
+
* Compare two strings by Unicode scalar values (code points), per
|
|
57
|
+
* RFC 9535 section 2.3.5.2.2. This differs from JavaScript's native
|
|
58
|
+
* `<`, which compares UTF-16 code units and orders surrogate pairs
|
|
59
|
+
* (U+10000 and up) below unpaired BMP characters in U+E000-U+FFFF.
|
|
60
|
+
* When one string is a prefix of the other, the shorter sorts first.
|
|
61
|
+
* @param {string} a
|
|
62
|
+
* @param {string} b
|
|
63
|
+
* @returns {number} -1 when a < b, 0 when equal, 1 when a > b
|
|
64
|
+
*/
|
|
65
|
+
export declare function compareCodePoints(a: string, b: string): number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isValidAlpha(str: any): boolean;
|
|
2
|
+
export declare function isValidAlphaNumeric(str: any): boolean;
|
|
3
|
+
export declare function isValidNumeric(str: any): boolean;
|
|
4
|
+
export declare function isValidHexaDecimal(str: any): boolean;
|
|
5
|
+
export declare function isValidHexColor(str: any): boolean;
|