@limitlesspc/std 0.21.1 → 0.22.0
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/dist/array.d.ts +21 -4
- package/dist/array.js +5 -4
- package/dist/async/index.d.ts +1 -1
- package/dist/async/index.js +1 -13
- package/dist/{chunk-65SNM7MP.js → chunk-4POIKW4G.js} +9 -13
- package/dist/{chunk-WNQNVZFS.js → chunk-BSIDYYJX.js} +74 -107
- package/dist/{chunk-WBSY6KRH.js → chunk-CCBSTDYA.js} +1 -1
- package/dist/{chunk-O3YCU3KN.js → chunk-SSSOLDLG.js} +2 -2
- package/dist/cmath/index.js +1 -1
- package/dist/events.js +5 -6
- package/dist/fn/index.d.ts +14 -1
- package/dist/fn/index.js +1 -2
- package/dist/gfx/index.d.ts +1 -1
- package/dist/gfx/index.js +5 -6
- package/dist/iter/index.js +2 -3
- package/dist/math/index.d.ts +39 -38
- package/dist/math/index.js +7 -14
- package/dist/random.js +4 -5
- package/dist/string/index.js +5 -3
- package/dist/structs/index.d.ts +2 -75
- package/dist/structs/index.js +232 -18
- package/dist/types.js +0 -1
- package/dist/{vec3-S_YuL-W1.d.ts → vec3-a5RuSVIr.d.ts} +5 -5
- package/package.json +51 -53
- package/dist/chunk-6F4PWJZI.js +0 -0
- package/dist/chunk-DYKZK6B5.js +0 -523
- package/dist/easing.d.ts +0 -37
- package/dist/easing.js +0 -157
- /package/dist/{chunk-MG5VQSTV.js → chunk-NXILTE26.js} +0 -0
package/dist/array.d.ts
CHANGED
|
@@ -161,9 +161,8 @@ declare function includesAny<T, U>(a: readonly T[], b: readonly U[]): boolean;
|
|
|
161
161
|
*/
|
|
162
162
|
declare function includesAll<T, U>(a: readonly T[], b: readonly U[]): boolean;
|
|
163
163
|
/**
|
|
164
|
-
* Returns
|
|
164
|
+
* Returns the unique items from an array
|
|
165
165
|
* @param array
|
|
166
|
-
* @param key
|
|
167
166
|
* @example
|
|
168
167
|
* ```ts
|
|
169
168
|
* const array = [
|
|
@@ -182,6 +181,24 @@ declare function includesAll<T, U>(a: readonly T[], b: readonly U[]): boolean;
|
|
|
182
181
|
* // ]
|
|
183
182
|
*/
|
|
184
183
|
declare function dedupe<T>(array: Iterable<T>): T[];
|
|
184
|
+
/**
|
|
185
|
+
* Returns the unique items from an array defined by a function
|
|
186
|
+
* @param array
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const array = [
|
|
190
|
+
* "cats",
|
|
191
|
+
* "cat",
|
|
192
|
+
* "dog",
|
|
193
|
+
* "dogs",
|
|
194
|
+
* ];
|
|
195
|
+
* // Two items are considered the duplicated if they share the same first 3 letters
|
|
196
|
+
* console.log(dedupeBy(array, item => item.slice(0, 3))); // [
|
|
197
|
+
* // "cats",
|
|
198
|
+
* // "dog",
|
|
199
|
+
* // ]
|
|
200
|
+
*/
|
|
201
|
+
declare function dedupeBy<T>(array: Iterable<T>, key: (item: T) => any): T[];
|
|
185
202
|
/**
|
|
186
203
|
* Returns a new array with items with a unique key
|
|
187
204
|
* @param array
|
|
@@ -226,6 +243,6 @@ declare function filterByKey<T>(array: readonly T[], key: keyof T): T[];
|
|
|
226
243
|
* // ]
|
|
227
244
|
* ```
|
|
228
245
|
*/
|
|
229
|
-
declare function sortByKeys<T, K extends keyof T>(array:
|
|
246
|
+
declare function sortByKeys<T, K extends keyof T>(array: T[], key: MaybeArray<K>, compare?: Compare<T[K]>): T[];
|
|
230
247
|
|
|
231
|
-
export { added, changes, dedupe, dedupeByKey, difference, equal, filterByKey, hasChange, includesAll, includesAny, intersection, remove, removed, sortByKeys, swap, union, unorderedRemove };
|
|
248
|
+
export { added, changes, dedupe, dedupeBy, dedupeByKey, difference, equal, filterByKey, hasChange, includesAll, includesAny, intersection, remove, removed, sortByKeys, swap, union, unorderedRemove };
|
package/dist/array.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
added,
|
|
3
3
|
changes,
|
|
4
4
|
dedupe,
|
|
5
|
+
dedupeBy,
|
|
5
6
|
dedupeByKey,
|
|
6
7
|
difference,
|
|
7
8
|
equal,
|
|
@@ -16,16 +17,16 @@ import {
|
|
|
16
17
|
swap,
|
|
17
18
|
union,
|
|
18
19
|
unorderedRemove
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-6F4PWJZI.js";
|
|
20
|
+
} from "./chunk-4POIKW4G.js";
|
|
21
|
+
import "./chunk-CCBSTDYA.js";
|
|
22
|
+
import "./chunk-NXILTE26.js";
|
|
23
23
|
import "./chunk-TMLWLR46.js";
|
|
24
24
|
import "./chunk-LJSF3QBT.js";
|
|
25
25
|
export {
|
|
26
26
|
added,
|
|
27
27
|
changes,
|
|
28
28
|
dedupe,
|
|
29
|
+
dedupeBy,
|
|
29
30
|
dedupeByKey,
|
|
30
31
|
difference,
|
|
31
32
|
equal,
|
package/dist/async/index.d.ts
CHANGED
package/dist/async/index.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Queue
|
|
3
|
-
} from "../chunk-DYKZK6B5.js";
|
|
4
|
-
import "../chunk-65SNM7MP.js";
|
|
5
|
-
import "../chunk-WBSY6KRH.js";
|
|
6
|
-
import "../chunk-MG5VQSTV.js";
|
|
7
|
-
import "../chunk-6F4PWJZI.js";
|
|
8
|
-
import "../chunk-TMLWLR46.js";
|
|
9
|
-
import "../chunk-LJSF3QBT.js";
|
|
10
|
-
|
|
11
1
|
// src/async/queue.ts
|
|
12
2
|
var TaskQueue = class {
|
|
13
3
|
constructor(tasks = []) {
|
|
@@ -95,12 +85,10 @@ function debounce(func, ms) {
|
|
|
95
85
|
async function concurrently(funcs, max) {
|
|
96
86
|
const tasks = [...funcs];
|
|
97
87
|
const results = Array.from({ length: tasks.length });
|
|
98
|
-
const queue = new Queue(tasks);
|
|
99
|
-
const length = queue.size;
|
|
100
88
|
let i = 0;
|
|
101
89
|
return new Promise((resolve) => {
|
|
102
90
|
const next = async () => {
|
|
103
|
-
const func =
|
|
91
|
+
const func = tasks.shift();
|
|
104
92
|
if (func) {
|
|
105
93
|
results[i++] = await func();
|
|
106
94
|
void next();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
zip
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CCBSTDYA.js";
|
|
4
4
|
import {
|
|
5
5
|
ascend
|
|
6
6
|
} from "./chunk-TMLWLR46.js";
|
|
@@ -90,21 +90,13 @@ function includesAll(a, b) {
|
|
|
90
90
|
return b.every((item) => a.includes(item));
|
|
91
91
|
}
|
|
92
92
|
function dedupe(array) {
|
|
93
|
-
|
|
94
|
-
const seen = /* @__PURE__ */ new Set();
|
|
95
|
-
for (const item of array) {
|
|
96
|
-
if (!seen.has(item)) {
|
|
97
|
-
result.push(item);
|
|
98
|
-
seen.add(item);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return result;
|
|
93
|
+
return dedupeBy(array, (x) => x);
|
|
102
94
|
}
|
|
103
|
-
function
|
|
95
|
+
function dedupeBy(array, key) {
|
|
104
96
|
const result = [];
|
|
105
97
|
const seen = /* @__PURE__ */ new Set();
|
|
106
98
|
for (const item of array) {
|
|
107
|
-
const value = item
|
|
99
|
+
const value = key(item);
|
|
108
100
|
if (!seen.has(value)) {
|
|
109
101
|
result.push(item);
|
|
110
102
|
seen.add(value);
|
|
@@ -112,11 +104,14 @@ function dedupeByKey(array, key) {
|
|
|
112
104
|
}
|
|
113
105
|
return result;
|
|
114
106
|
}
|
|
107
|
+
function dedupeByKey(array, key) {
|
|
108
|
+
return dedupeBy(array, (x) => x[key]);
|
|
109
|
+
}
|
|
115
110
|
function filterByKey(array, key) {
|
|
116
111
|
return array.filter((item) => item[key]);
|
|
117
112
|
}
|
|
118
113
|
function sortByKeys(array, key, compare = ascend) {
|
|
119
|
-
return
|
|
114
|
+
return array.toSorted((a, b) => {
|
|
120
115
|
const keys = Array.isArray(key) ? key : [key];
|
|
121
116
|
for (const key2 of keys) {
|
|
122
117
|
const value1 = a[key2];
|
|
@@ -145,6 +140,7 @@ export {
|
|
|
145
140
|
includesAny,
|
|
146
141
|
includesAll,
|
|
147
142
|
dedupe,
|
|
143
|
+
dedupeBy,
|
|
148
144
|
dedupeByKey,
|
|
149
145
|
filterByKey,
|
|
150
146
|
sortByKeys
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
random
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SSSOLDLG.js";
|
|
4
4
|
import {
|
|
5
5
|
chunk,
|
|
6
6
|
collect,
|
|
7
7
|
filter,
|
|
8
8
|
map,
|
|
9
|
-
range
|
|
10
|
-
|
|
11
|
-
} from "./chunk-WBSY6KRH.js";
|
|
9
|
+
range
|
|
10
|
+
} from "./chunk-CCBSTDYA.js";
|
|
12
11
|
import {
|
|
13
12
|
pipe,
|
|
14
13
|
reverseCurry
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NXILTE26.js";
|
|
16
15
|
|
|
17
16
|
// src/math/stats.ts
|
|
18
17
|
function min(iter) {
|
|
@@ -74,11 +73,12 @@ function median(array) {
|
|
|
74
73
|
if (!length) {
|
|
75
74
|
return 0;
|
|
76
75
|
}
|
|
77
|
-
const sorted =
|
|
76
|
+
const sorted = array.toSorted((a, b) => a - b);
|
|
77
|
+
const halfLen = length / 2;
|
|
78
78
|
if (length % 2) {
|
|
79
|
-
return sorted[
|
|
79
|
+
return sorted[Math.floor(halfLen)];
|
|
80
80
|
}
|
|
81
|
-
return (sorted[
|
|
81
|
+
return (sorted[halfLen - 1] + sorted[halfLen]) / 2;
|
|
82
82
|
}
|
|
83
83
|
function mode(iter) {
|
|
84
84
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -95,33 +95,34 @@ function mode(iter) {
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
function variance(iter) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
map(
|
|
102
|
-
const d =
|
|
98
|
+
const mean = avg(iter);
|
|
99
|
+
return pipe(
|
|
100
|
+
iter,
|
|
101
|
+
map((x) => {
|
|
102
|
+
const d = x - mean;
|
|
103
103
|
return d * d;
|
|
104
|
-
})
|
|
104
|
+
}),
|
|
105
|
+
avg
|
|
105
106
|
);
|
|
106
107
|
}
|
|
107
108
|
function stddev(iter) {
|
|
108
109
|
return Math.sqrt(variance(iter));
|
|
109
110
|
}
|
|
110
111
|
function meanAbsDev(iter) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
const mean = avg(iter);
|
|
113
|
+
return pipe(
|
|
114
|
+
iter,
|
|
115
|
+
map((x) => Math.abs(x - mean)),
|
|
116
|
+
avg
|
|
117
|
+
);
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
// src/math/funcs.ts
|
|
117
121
|
function isNumber(x) {
|
|
118
122
|
return typeof x === "number" && !Number.isNaN(x);
|
|
119
123
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
function isInteger(x) {
|
|
124
|
-
return Number.isInteger(x);
|
|
124
|
+
function sq(x) {
|
|
125
|
+
return x * x;
|
|
125
126
|
}
|
|
126
127
|
function roundToMultiple(x, n) {
|
|
127
128
|
return Math.floor(x / n) * n;
|
|
@@ -161,7 +162,7 @@ function overlap(min1, max1, min2, max2) {
|
|
|
161
162
|
return range1 + range2 - range3;
|
|
162
163
|
}
|
|
163
164
|
function closer(x, a, b) {
|
|
164
|
-
return Math.abs(x - a
|
|
165
|
+
return Math.abs(x - a) < Math.abs(x - b) ? a : b;
|
|
165
166
|
}
|
|
166
167
|
function round(n, precision = 0) {
|
|
167
168
|
const factor = 10 ** precision;
|
|
@@ -216,23 +217,6 @@ function fibonacci(n) {
|
|
|
216
217
|
}
|
|
217
218
|
var celsius = (fahrenheit2) => (fahrenheit2 - 32) * (5 / 9);
|
|
218
219
|
var fahrenheit = (celsius2) => celsius2 * (9 / 5) + 32;
|
|
219
|
-
function lineOfBestFit(points) {
|
|
220
|
-
const xs = points.map((p) => p.x);
|
|
221
|
-
const ys = points.map((p) => p.y);
|
|
222
|
-
const meanX = avg(xs);
|
|
223
|
-
const meanY = avg(ys);
|
|
224
|
-
let n = 0;
|
|
225
|
-
let den = 0;
|
|
226
|
-
for (let i = 0; i < points.length; i++) {
|
|
227
|
-
const x = xs[i];
|
|
228
|
-
const y = ys[i];
|
|
229
|
-
n += (x - meanX) * (y - meanY);
|
|
230
|
-
den += (x - meanX) ** 2;
|
|
231
|
-
}
|
|
232
|
-
const m = n / den;
|
|
233
|
-
const b = meanY - m * meanX;
|
|
234
|
-
return [m, b];
|
|
235
|
-
}
|
|
236
220
|
function permutations(n, k) {
|
|
237
221
|
if (k > n) {
|
|
238
222
|
return 0;
|
|
@@ -245,20 +229,6 @@ function combinations(n, k) {
|
|
|
245
229
|
}
|
|
246
230
|
return permutations(n, k) / factorial(k);
|
|
247
231
|
}
|
|
248
|
-
function dot(a, b) {
|
|
249
|
-
const iter1 = a[Symbol.iterator]();
|
|
250
|
-
const iter2 = b[Symbol.iterator]();
|
|
251
|
-
let total = 0;
|
|
252
|
-
while (true) {
|
|
253
|
-
const result1 = iter1.next();
|
|
254
|
-
const result2 = iter2.next();
|
|
255
|
-
if (result1.done && result2.done) {
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
total += (result1.value || 0) * (result2.value || 0);
|
|
259
|
-
}
|
|
260
|
-
return total;
|
|
261
|
-
}
|
|
262
232
|
|
|
263
233
|
// src/iter/repeat.ts
|
|
264
234
|
var repeat = reverseCurry(function* repeat2(iter, n) {
|
|
@@ -827,8 +797,8 @@ function mat4(matrix) {
|
|
|
827
797
|
|
|
828
798
|
// src/math/trig.ts
|
|
829
799
|
var DEG2RAD = Math.PI / 180;
|
|
830
|
-
var degrees = (radians2) => radians2 / DEG2RAD;
|
|
831
800
|
var radians = (degrees2) => degrees2 * DEG2RAD;
|
|
801
|
+
var degrees = (radians2) => radians2 / DEG2RAD;
|
|
832
802
|
|
|
833
803
|
// src/math/vector/vec2.ts
|
|
834
804
|
var Vec2 = class _Vec2 extends Float32Array {
|
|
@@ -929,17 +899,17 @@ var Vec2 = class _Vec2 extends Float32Array {
|
|
|
929
899
|
static fma(a, b, c) {
|
|
930
900
|
return vec2(a[0] * b[0] + c[0], a[1] * b[1] + c[1]);
|
|
931
901
|
}
|
|
932
|
-
lt(
|
|
933
|
-
return vec2(this.x <
|
|
902
|
+
lt(v) {
|
|
903
|
+
return vec2(this.x < v[0] ? 1 : 0, this.y < v[1] ? 1 : 0);
|
|
934
904
|
}
|
|
935
|
-
lte(
|
|
936
|
-
return vec2(this.x <=
|
|
905
|
+
lte(v) {
|
|
906
|
+
return vec2(this.x <= v[0] ? 1 : 0, this.y <= v[1] ? 1 : 0);
|
|
937
907
|
}
|
|
938
|
-
gt(
|
|
939
|
-
return vec2(this.x >
|
|
908
|
+
gt(v) {
|
|
909
|
+
return vec2(this.x > v[0] ? 1 : 0, this.y > v[1] ? 1 : 0);
|
|
940
910
|
}
|
|
941
|
-
gte(
|
|
942
|
-
return vec2(this.x >=
|
|
911
|
+
gte(v) {
|
|
912
|
+
return vec2(this.x >= v[0] ? 1 : 0, this.y >= v[1] ? 1 : 0);
|
|
943
913
|
}
|
|
944
914
|
mag() {
|
|
945
915
|
return Math.sqrt(this.magSq());
|
|
@@ -1032,13 +1002,13 @@ var Vec2 = class _Vec2 extends Float32Array {
|
|
|
1032
1002
|
return this.sub(_Vec2.mul(normal, 2 * this.dot(normal)));
|
|
1033
1003
|
}
|
|
1034
1004
|
refract(normal, eta) {
|
|
1035
|
-
const
|
|
1036
|
-
const k = 1 - eta * eta * (1 -
|
|
1005
|
+
const dot = this.dot(normal);
|
|
1006
|
+
const k = 1 - eta * eta * (1 - dot * dot);
|
|
1037
1007
|
if (k < 0) {
|
|
1038
1008
|
this.x = this.y = 0;
|
|
1039
1009
|
return this;
|
|
1040
1010
|
}
|
|
1041
|
-
return this.mul(eta).sub(_Vec2.mul(normal, eta *
|
|
1011
|
+
return this.mul(eta).sub(_Vec2.mul(normal, eta * dot + Math.sqrt(k)));
|
|
1042
1012
|
}
|
|
1043
1013
|
};
|
|
1044
1014
|
function vec2(x, y) {
|
|
@@ -1188,32 +1158,32 @@ var Vec3 = class _Vec3 extends Float32Array {
|
|
|
1188
1158
|
static fma(a, b, c) {
|
|
1189
1159
|
return vec3(a[0] * b[0] + c[0], a[1] * b[1] + c[1], a[2] * b[2] + c[2]);
|
|
1190
1160
|
}
|
|
1191
|
-
lt(
|
|
1161
|
+
lt(v) {
|
|
1192
1162
|
return vec3(
|
|
1193
|
-
this.x <
|
|
1194
|
-
this.y <
|
|
1195
|
-
this.z <
|
|
1163
|
+
this.x < v[0] ? 1 : 0,
|
|
1164
|
+
this.y < v[1] ? 1 : 0,
|
|
1165
|
+
this.z < v[2] ? 1 : 0
|
|
1196
1166
|
);
|
|
1197
1167
|
}
|
|
1198
|
-
lte(
|
|
1168
|
+
lte(v) {
|
|
1199
1169
|
return vec3(
|
|
1200
|
-
this.x <=
|
|
1201
|
-
this.y <=
|
|
1202
|
-
this.z <=
|
|
1170
|
+
this.x <= v[0] ? 1 : 0,
|
|
1171
|
+
this.y <= v[1] ? 1 : 0,
|
|
1172
|
+
this.z <= v[2] ? 1 : 0
|
|
1203
1173
|
);
|
|
1204
1174
|
}
|
|
1205
|
-
gt(
|
|
1175
|
+
gt(v) {
|
|
1206
1176
|
return vec3(
|
|
1207
|
-
this.x >
|
|
1208
|
-
this.y >
|
|
1209
|
-
this.z >
|
|
1177
|
+
this.x > v[0] ? 1 : 0,
|
|
1178
|
+
this.y > v[1] ? 1 : 0,
|
|
1179
|
+
this.z > v[2] ? 1 : 0
|
|
1210
1180
|
);
|
|
1211
1181
|
}
|
|
1212
|
-
gte(
|
|
1182
|
+
gte(v) {
|
|
1213
1183
|
return vec3(
|
|
1214
|
-
this.x >=
|
|
1215
|
-
this.y >=
|
|
1216
|
-
this.z >=
|
|
1184
|
+
this.x >= v[0] ? 1 : 0,
|
|
1185
|
+
this.y >= v[1] ? 1 : 0,
|
|
1186
|
+
this.z >= v[2] ? 1 : 0
|
|
1217
1187
|
);
|
|
1218
1188
|
}
|
|
1219
1189
|
limit(max2) {
|
|
@@ -1489,36 +1459,36 @@ var Vec4 = class _Vec4 extends Float32Array {
|
|
|
1489
1459
|
a[3] * b[3] + c[3]
|
|
1490
1460
|
);
|
|
1491
1461
|
}
|
|
1492
|
-
lt(
|
|
1462
|
+
lt(v) {
|
|
1493
1463
|
return vec4(
|
|
1494
|
-
this.x <
|
|
1495
|
-
this.y <
|
|
1496
|
-
this.z <
|
|
1497
|
-
this.w <
|
|
1464
|
+
this.x < v[0] ? 1 : 0,
|
|
1465
|
+
this.y < v[1] ? 1 : 0,
|
|
1466
|
+
this.z < v[2] ? 1 : 0,
|
|
1467
|
+
this.w < v[3] ? 1 : 0
|
|
1498
1468
|
);
|
|
1499
1469
|
}
|
|
1500
|
-
lte(
|
|
1470
|
+
lte(v) {
|
|
1501
1471
|
return vec4(
|
|
1502
|
-
this.x <=
|
|
1503
|
-
this.y <=
|
|
1504
|
-
this.z <=
|
|
1505
|
-
this.w <=
|
|
1472
|
+
this.x <= v[0] ? 1 : 0,
|
|
1473
|
+
this.y <= v[1] ? 1 : 0,
|
|
1474
|
+
this.z <= v[2] ? 1 : 0,
|
|
1475
|
+
this.w <= v[3] ? 1 : 0
|
|
1506
1476
|
);
|
|
1507
1477
|
}
|
|
1508
|
-
gt(
|
|
1478
|
+
gt(v) {
|
|
1509
1479
|
return vec4(
|
|
1510
|
-
this.x >
|
|
1511
|
-
this.y >
|
|
1512
|
-
this.z >
|
|
1513
|
-
this.w >
|
|
1480
|
+
this.x > v[0] ? 1 : 0,
|
|
1481
|
+
this.y > v[1] ? 1 : 0,
|
|
1482
|
+
this.z > v[2] ? 1 : 0,
|
|
1483
|
+
this.w > v[3] ? 1 : 0
|
|
1514
1484
|
);
|
|
1515
1485
|
}
|
|
1516
|
-
gte(
|
|
1486
|
+
gte(v) {
|
|
1517
1487
|
return vec4(
|
|
1518
|
-
this.x >=
|
|
1519
|
-
this.y >=
|
|
1520
|
-
this.z >=
|
|
1521
|
-
this.w >=
|
|
1488
|
+
this.x >= v[0] ? 1 : 0,
|
|
1489
|
+
this.y >= v[1] ? 1 : 0,
|
|
1490
|
+
this.z >= v[2] ? 1 : 0,
|
|
1491
|
+
this.w >= v[3] ? 1 : 0
|
|
1522
1492
|
);
|
|
1523
1493
|
}
|
|
1524
1494
|
limit(max2) {
|
|
@@ -1614,8 +1584,7 @@ export {
|
|
|
1614
1584
|
stddev,
|
|
1615
1585
|
meanAbsDev,
|
|
1616
1586
|
isNumber,
|
|
1617
|
-
|
|
1618
|
-
isInteger,
|
|
1587
|
+
sq,
|
|
1619
1588
|
roundToMultiple,
|
|
1620
1589
|
roundToEven,
|
|
1621
1590
|
norm,
|
|
@@ -1640,10 +1609,8 @@ export {
|
|
|
1640
1609
|
fibonacci,
|
|
1641
1610
|
celsius,
|
|
1642
1611
|
fahrenheit,
|
|
1643
|
-
lineOfBestFit,
|
|
1644
1612
|
permutations,
|
|
1645
1613
|
combinations,
|
|
1646
|
-
dot,
|
|
1647
1614
|
Mat,
|
|
1648
1615
|
mat,
|
|
1649
1616
|
Mat2,
|
|
@@ -1653,8 +1620,8 @@ export {
|
|
|
1653
1620
|
Mat4,
|
|
1654
1621
|
mat4,
|
|
1655
1622
|
DEG2RAD,
|
|
1656
|
-
degrees,
|
|
1657
1623
|
radians,
|
|
1624
|
+
degrees,
|
|
1658
1625
|
Vec2,
|
|
1659
1626
|
vec2,
|
|
1660
1627
|
Vec3,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
swap,
|
|
3
3
|
unorderedRemove
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4POIKW4G.js";
|
|
5
5
|
|
|
6
6
|
// src/random.ts
|
|
7
7
|
function random(min, max) {
|
|
@@ -21,7 +21,7 @@ function randomInt(min = 0, max) {
|
|
|
21
21
|
return Math.floor(random(min + 1));
|
|
22
22
|
}
|
|
23
23
|
function shuffle(array) {
|
|
24
|
-
for (let
|
|
24
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
25
25
|
const j = randomInt(i);
|
|
26
26
|
swap(array, i, j);
|
|
27
27
|
}
|
package/dist/cmath/index.js
CHANGED
package/dist/events.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sum
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-BSIDYYJX.js";
|
|
4
|
+
import "./chunk-SSSOLDLG.js";
|
|
5
|
+
import "./chunk-4POIKW4G.js";
|
|
6
6
|
import {
|
|
7
7
|
pick
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CCBSTDYA.js";
|
|
9
9
|
import {
|
|
10
10
|
pipe
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-6F4PWJZI.js";
|
|
11
|
+
} from "./chunk-NXILTE26.js";
|
|
13
12
|
import "./chunk-TMLWLR46.js";
|
|
14
13
|
import "./chunk-LJSF3QBT.js";
|
|
15
14
|
|
package/dist/fn/index.d.ts
CHANGED
|
@@ -34,9 +34,22 @@ type ReverseCurry<Fn extends AnyFunction, Args = Parameters<Fn>> = Args extends
|
|
|
34
34
|
(...rest: Rest): (first: First) => ReturnType<Fn>;
|
|
35
35
|
} : never;
|
|
36
36
|
/**
|
|
37
|
-
* Create a function that takes in the first parameter of another
|
|
37
|
+
* Create a function that takes in the first parameter of another
|
|
38
|
+
* In other words, it gives you a function that when called with every parameter other than the first, will output a function that takes the first parameter only
|
|
38
39
|
* @param fn
|
|
39
40
|
* @returns a functions a that takes in the rest of the arguments of `fn` and returns a function that takes the first argument of `fn` to finally return the result of `fn`
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* // Fused multiply-add
|
|
44
|
+
* function fma(a: number, b: number, c: number) {
|
|
45
|
+
* return a * b + c;
|
|
46
|
+
* }
|
|
47
|
+
* const curried = reverseCurry(fma);
|
|
48
|
+
*
|
|
49
|
+
* const times3Add2Fma = curried(3, 2);
|
|
50
|
+
* times3Add2Fma(4); // 4 * 3 + 2 = 14
|
|
51
|
+
* times3Add2Fma(0); // 0 * 3 + 2 = 2
|
|
52
|
+
* ```
|
|
40
53
|
*/
|
|
41
54
|
declare const reverseCurry: <Fn extends AnyFunction>(fn: Fn) => ReverseCurry<Fn>;
|
|
42
55
|
|
package/dist/fn/index.js
CHANGED
package/dist/gfx/index.d.ts
CHANGED
package/dist/gfx/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
vec3
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-6F4PWJZI.js";
|
|
3
|
+
} from "../chunk-BSIDYYJX.js";
|
|
4
|
+
import "../chunk-SSSOLDLG.js";
|
|
5
|
+
import "../chunk-4POIKW4G.js";
|
|
6
|
+
import "../chunk-CCBSTDYA.js";
|
|
7
|
+
import "../chunk-NXILTE26.js";
|
|
9
8
|
import "../chunk-TMLWLR46.js";
|
|
10
9
|
import "../chunk-LJSF3QBT.js";
|
|
11
10
|
|
package/dist/iter/index.js
CHANGED
|
@@ -28,9 +28,8 @@ import {
|
|
|
28
28
|
uniqueBy,
|
|
29
29
|
unzip,
|
|
30
30
|
zip
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-6F4PWJZI.js";
|
|
31
|
+
} from "../chunk-CCBSTDYA.js";
|
|
32
|
+
import "../chunk-NXILTE26.js";
|
|
34
33
|
import "../chunk-LJSF3QBT.js";
|
|
35
34
|
export {
|
|
36
35
|
associateBy,
|