@holoscript/std 3.1.1 → 6.0.3
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/dist/__tests__/EconomicPrimitives.test.d.ts +2 -0
- package/dist/__tests__/EconomicTraits.test.d.ts +2 -0
- package/dist/__tests__/SimulationLabPrimitives.test.d.ts +2 -0
- package/dist/__tests__/collections.test.d.ts +2 -0
- package/dist/__tests__/events.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/materials.test.d.ts +2 -0
- package/dist/__tests__/math.test.d.ts +2 -0
- package/dist/__tests__/physics.test.d.ts +2 -0
- package/dist/__tests__/spatial.test.d.ts +2 -0
- package/dist/__tests__/standard-library-fundamentals.test.d.ts +2 -0
- package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +1 -0
- package/dist/__tests__/string-and-time-utilities.test.d.ts +2 -0
- package/dist/__tests__/string-and-time-utilities.test.d.ts.map +1 -0
- package/dist/__tests__/string-decoupled.test.d.ts +2 -0
- package/dist/__tests__/string.test.d.ts +2 -0
- package/dist/__tests__/time.test.d.ts +2 -0
- package/dist/chunk-7HVUYGPS.js +679 -0
- package/dist/chunk-7HVUYGPS.js.map +1 -0
- package/dist/chunk-P4O3WNG2.js +287 -0
- package/dist/chunk-P4O3WNG2.js.map +1 -0
- package/dist/chunk-PFX2JM4X.js +683 -0
- package/dist/chunk-PFX2JM4X.js.map +1 -0
- package/dist/chunk-W2Q3LUCM.js +348 -0
- package/dist/chunk-W2Q3LUCM.js.map +1 -0
- package/dist/chunk-WS6W35YC.js +443 -0
- package/dist/chunk-WS6W35YC.js.map +1 -0
- package/dist/chunk-ZXVZAQCZ.js +470 -0
- package/dist/chunk-ZXVZAQCZ.js.map +1 -0
- package/dist/collections.cjs +715 -0
- package/dist/collections.cjs.map +1 -0
- package/dist/collections.d.ts +177 -0
- package/dist/collections.js +17 -0
- package/dist/collections.js.map +1 -0
- package/dist/events.d.ts +32 -0
- package/dist/index.cjs +4101 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +1270 -190
- package/dist/index.js.map +1 -0
- package/dist/materials.d.ts +50 -0
- package/dist/math.cjs +591 -0
- package/dist/math.cjs.map +1 -0
- package/dist/math.d.ts +162 -0
- package/dist/math.js +53 -0
- package/dist/math.js.map +1 -0
- package/dist/physics.d.ts +59 -0
- package/dist/spatial.d.ts +82 -0
- package/dist/string.basic.test.d.ts +5 -0
- package/dist/string.basic.test.d.ts.map +1 -0
- package/dist/string.cjs +422 -0
- package/dist/string.cjs.map +1 -0
- package/dist/string.d.ts +212 -0
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +107 -0
- package/dist/string.js.map +1 -0
- package/dist/string.test.d.ts +5 -0
- package/dist/string.test.d.ts.map +1 -0
- package/dist/time.cjs +512 -0
- package/dist/time.cjs.map +1 -0
- package/dist/time.d.ts +215 -0
- package/dist/time.js +43 -0
- package/dist/time.js.map +1 -0
- package/dist/traits/ARTraits.d.ts +14 -0
- package/dist/traits/EconomicPrimitives.cjs +335 -0
- package/dist/traits/EconomicPrimitives.cjs.map +1 -0
- package/dist/traits/EconomicPrimitives.d.ts +345 -0
- package/dist/traits/EconomicPrimitives.js +55 -0
- package/dist/traits/EconomicPrimitives.js.map +1 -0
- package/dist/traits/EconomicTraits.cjs +471 -0
- package/dist/traits/EconomicTraits.cjs.map +1 -0
- package/dist/traits/EconomicTraits.d.ts +71 -0
- package/dist/traits/EconomicTraits.js +17 -0
- package/dist/traits/EconomicTraits.js.map +1 -0
- package/dist/traits/IoTTraits.d.ts +14 -0
- package/dist/traits/SimulationLabPrimitives.d.ts +187 -0
- package/dist/traits/SimulationLabTraits.d.ts +42 -0
- package/dist/traits/VRRTraits.d.ts +150 -0
- package/dist/traits/__tests__/ARTraits.test.d.ts +2 -0
- package/dist/traits/__tests__/ARTraits.test.d.ts.map +1 -0
- package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +2 -0
- package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +1 -0
- package/dist/traits/__tests__/EconomicTraits.test.d.ts +2 -0
- package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +1 -0
- package/dist/types.d.ts +202 -0
- package/error-utf8.log +6 -0
- package/error.log +0 -0
- package/package.json +30 -18
- package/src/__tests__/index.test.ts +14 -0
- package/src/__tests__/{Sprint33.test.ts → standard-library-fundamentals.test.ts} +70 -70
- package/src/__tests__/{Sprint56.test.ts → string-and-time-utilities.test.ts} +64 -64
- package/src/__tests__/string-decoupled.test.ts +0 -2
- package/src/string.basic.test.ts +1 -1
- package/src/string.test.ts +4 -4
- package/src/string.ts +30 -15
- package/src/time.ts +1 -1
- package/src/traits/__tests__/ARTraits.test.ts +14 -0
- package/src/traits/__tests__/EconomicPrimitives.test.ts +14 -0
- package/src/traits/__tests__/EconomicTraits.test.ts +14 -0
- package/std_error.log +5 -0
- package/tsup.config.ts +17 -0
- package/dist/__tests__/Sprint33.test.d.ts.map +0 -1
- package/dist/__tests__/Sprint56.test.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holoscript/std",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "HoloScript Standard Library - Core types and utilities",
|
|
5
|
-
"main": "dist/index.
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
12
14
|
},
|
|
13
15
|
"./math": {
|
|
14
16
|
"types": "./dist/math.d.ts",
|
|
15
|
-
"import": "./dist/math.js"
|
|
17
|
+
"import": "./dist/math.js",
|
|
18
|
+
"require": "./dist/math.cjs"
|
|
16
19
|
},
|
|
17
20
|
"./collections": {
|
|
18
21
|
"types": "./dist/collections.d.ts",
|
|
19
|
-
"import": "./dist/collections.js"
|
|
22
|
+
"import": "./dist/collections.js",
|
|
23
|
+
"require": "./dist/collections.cjs"
|
|
20
24
|
},
|
|
21
25
|
"./string": {
|
|
22
26
|
"types": "./dist/string.d.ts",
|
|
23
|
-
"import": "./dist/string.js"
|
|
27
|
+
"import": "./dist/string.js",
|
|
28
|
+
"require": "./dist/string.cjs"
|
|
24
29
|
},
|
|
25
30
|
"./time": {
|
|
26
31
|
"types": "./dist/time.d.ts",
|
|
27
|
-
"import": "./dist/time.js"
|
|
32
|
+
"import": "./dist/time.js",
|
|
33
|
+
"require": "./dist/time.cjs"
|
|
28
34
|
},
|
|
29
35
|
"./economic": {
|
|
30
36
|
"types": "./dist/traits/EconomicPrimitives.d.ts",
|
|
31
|
-
"import": "./dist/traits/EconomicPrimitives.js"
|
|
37
|
+
"import": "./dist/traits/EconomicPrimitives.js",
|
|
38
|
+
"require": "./dist/traits/EconomicPrimitives.cjs"
|
|
32
39
|
},
|
|
33
40
|
"./economic-traits": {
|
|
34
41
|
"types": "./dist/traits/EconomicTraits.d.ts",
|
|
35
|
-
"import": "./dist/traits/EconomicTraits.js"
|
|
42
|
+
"import": "./dist/traits/EconomicTraits.js",
|
|
43
|
+
"require": "./dist/traits/EconomicTraits.cjs"
|
|
36
44
|
}
|
|
37
45
|
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsc",
|
|
40
|
-
"watch": "tsc -w",
|
|
41
|
-
"clean": "rm -rf dist",
|
|
42
|
-
"test": "vitest run --passWithNoTests"
|
|
43
|
-
},
|
|
44
46
|
"keywords": [
|
|
45
47
|
"holoscript",
|
|
46
48
|
"std",
|
|
@@ -55,12 +57,22 @@
|
|
|
55
57
|
"license": "MIT",
|
|
56
58
|
"repository": {
|
|
57
59
|
"type": "git",
|
|
58
|
-
"url": "https://github.com/brianonbased-dev/
|
|
60
|
+
"url": "https://github.com/brianonbased-dev/HoloScript.git",
|
|
59
61
|
"directory": "packages/std"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@types/node": "^24.10.1",
|
|
63
65
|
"typescript": "~5.9.3",
|
|
64
|
-
"vitest": "^4.
|
|
66
|
+
"vitest": "^4.1.4"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/brianonbased-dev/HoloScript#readme",
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/brianonbased-dev/HoloScript/issues"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsup && tsc --emitDeclarationOnly --declarationDir dist --skipLibCheck",
|
|
74
|
+
"watch": "tsc -w",
|
|
75
|
+
"clean": "rm -rf dist",
|
|
76
|
+
"test": "vitest run --passWithNoTests"
|
|
65
77
|
}
|
|
66
|
-
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
|
|
3
|
+
// Auto-generated test for index
|
|
4
|
+
// Source: packages/std/src/index.ts
|
|
5
|
+
|
|
6
|
+
describe('index', () => {
|
|
7
|
+
it('should be defined', () => {
|
|
8
|
+
// TODO: Import and test index
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should have basic functionality', () => {
|
|
12
|
+
// TODO: Add meaningful tests for index
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @holoscript/std acceptance tests
|
|
3
3
|
* Covers: types, collections, math, string, time
|
|
4
4
|
*/
|
|
5
5
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// ─────────────────────────────────────────────
|
|
8
8
|
// types.ts
|
|
9
|
-
//
|
|
9
|
+
// ─────────────────────────────────────────────
|
|
10
10
|
import {
|
|
11
11
|
vec2,
|
|
12
12
|
vec3,
|
|
@@ -26,14 +26,14 @@ import {
|
|
|
26
26
|
colorToHex,
|
|
27
27
|
} from '../types.js';
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// ─────────────────────────────────────────────
|
|
30
30
|
// collections.ts
|
|
31
|
-
//
|
|
31
|
+
// ─────────────────────────────────────────────
|
|
32
32
|
import { List, HoloMap, HoloSet, SpatialGrid, PriorityQueue } from '../collections.js';
|
|
33
33
|
|
|
34
|
-
//
|
|
34
|
+
// ─────────────────────────────────────────────
|
|
35
35
|
// math.ts
|
|
36
|
-
//
|
|
36
|
+
// ─────────────────────────────────────────────
|
|
37
37
|
import {
|
|
38
38
|
PI,
|
|
39
39
|
TAU,
|
|
@@ -60,9 +60,9 @@ import {
|
|
|
60
60
|
random,
|
|
61
61
|
} from '../math.js';
|
|
62
62
|
|
|
63
|
-
//
|
|
63
|
+
// ─────────────────────────────────────────────
|
|
64
64
|
// string.ts
|
|
65
|
-
//
|
|
65
|
+
// ─────────────────────────────────────────────
|
|
66
66
|
import {
|
|
67
67
|
capitalize,
|
|
68
68
|
titleCase,
|
|
@@ -113,9 +113,9 @@ import {
|
|
|
113
113
|
uuid,
|
|
114
114
|
} from '../string.js';
|
|
115
115
|
|
|
116
|
-
//
|
|
116
|
+
// ─────────────────────────────────────────────
|
|
117
117
|
// time.ts
|
|
118
|
-
//
|
|
118
|
+
// ─────────────────────────────────────────────
|
|
119
119
|
import {
|
|
120
120
|
now,
|
|
121
121
|
sleep,
|
|
@@ -127,10 +127,10 @@ import {
|
|
|
127
127
|
DateTime,
|
|
128
128
|
} from '../time.js';
|
|
129
129
|
|
|
130
|
-
//
|
|
130
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
131
131
|
// types.ts
|
|
132
|
-
//
|
|
133
|
-
describe('types
|
|
132
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
133
|
+
describe('types — factory functions', () => {
|
|
134
134
|
it('vec2 defaults to (0,0)', () => {
|
|
135
135
|
const v = vec2();
|
|
136
136
|
expect(v.x).toBe(0);
|
|
@@ -203,7 +203,7 @@ describe('types — factory functions', () => {
|
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
describe('types
|
|
206
|
+
describe('types — conversion utilities', () => {
|
|
207
207
|
it('vec3ToArray / arrayToVec3 round-trip', () => {
|
|
208
208
|
const v = vec3(1, 2, 3);
|
|
209
209
|
const arr = vec3ToArray(v);
|
|
@@ -236,9 +236,9 @@ describe('types — conversion utilities', () => {
|
|
|
236
236
|
});
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
-
//
|
|
240
|
-
// collections
|
|
241
|
-
//
|
|
239
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
240
|
+
// collections — List
|
|
241
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
242
242
|
describe('List', () => {
|
|
243
243
|
it('creates empty list', () => {
|
|
244
244
|
const l = new List<number>();
|
|
@@ -363,9 +363,9 @@ describe('List', () => {
|
|
|
363
363
|
});
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
-
//
|
|
367
|
-
// collections
|
|
368
|
-
//
|
|
366
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
367
|
+
// collections — HoloMap
|
|
368
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
369
369
|
describe('HoloMap', () => {
|
|
370
370
|
it('creates empty map', () => {
|
|
371
371
|
const m = new HoloMap<string, number>();
|
|
@@ -435,9 +435,9 @@ describe('HoloMap', () => {
|
|
|
435
435
|
});
|
|
436
436
|
});
|
|
437
437
|
|
|
438
|
-
//
|
|
439
|
-
// collections
|
|
440
|
-
//
|
|
438
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
439
|
+
// collections — HoloSet
|
|
440
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
441
441
|
describe('HoloSet', () => {
|
|
442
442
|
it('creates empty set', () => {
|
|
443
443
|
const s = new HoloSet<number>();
|
|
@@ -516,9 +516,9 @@ describe('HoloSet', () => {
|
|
|
516
516
|
});
|
|
517
517
|
});
|
|
518
518
|
|
|
519
|
-
//
|
|
520
|
-
// collections
|
|
521
|
-
//
|
|
519
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
520
|
+
// collections — PriorityQueue
|
|
521
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
522
522
|
describe('PriorityQueue', () => {
|
|
523
523
|
it('minHeap dequeues lowest priority first', () => {
|
|
524
524
|
const pq = PriorityQueue.minHeap<string>();
|
|
@@ -561,9 +561,9 @@ describe('PriorityQueue', () => {
|
|
|
561
561
|
});
|
|
562
562
|
});
|
|
563
563
|
|
|
564
|
-
//
|
|
565
|
-
// collections
|
|
566
|
-
//
|
|
564
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
565
|
+
// collections — SpatialGrid
|
|
566
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
567
567
|
describe('SpatialGrid', () => {
|
|
568
568
|
it('insert and query by radius', () => {
|
|
569
569
|
const grid = new SpatialGrid<string>(1.0);
|
|
@@ -592,9 +592,9 @@ describe('SpatialGrid', () => {
|
|
|
592
592
|
});
|
|
593
593
|
});
|
|
594
594
|
|
|
595
|
-
//
|
|
596
|
-
// math
|
|
597
|
-
//
|
|
595
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
596
|
+
// math — constants
|
|
597
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
598
598
|
describe('math constants', () => {
|
|
599
599
|
it('PI is ~3.14159', () => expect(PI).toBeCloseTo(3.14159, 4));
|
|
600
600
|
it('TAU is 2*PI', () => expect(TAU).toBeCloseTo(PI * 2, 10));
|
|
@@ -604,10 +604,10 @@ describe('math constants', () => {
|
|
|
604
604
|
it('EPSILON is small', () => expect(EPSILON).toBeGreaterThan(0));
|
|
605
605
|
});
|
|
606
606
|
|
|
607
|
-
//
|
|
608
|
-
// math
|
|
609
|
-
//
|
|
610
|
-
describe('math
|
|
607
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
608
|
+
// math — basic functions
|
|
609
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
610
|
+
describe('math — basic functions', () => {
|
|
611
611
|
it('clamp', () => {
|
|
612
612
|
expect(clamp(5, 0, 10)).toBe(5);
|
|
613
613
|
expect(clamp(-5, 0, 10)).toBe(0);
|
|
@@ -664,9 +664,9 @@ describe('math — basic functions', () => {
|
|
|
664
664
|
});
|
|
665
665
|
});
|
|
666
666
|
|
|
667
|
-
//
|
|
668
|
-
// math
|
|
669
|
-
//
|
|
667
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
668
|
+
// math — vec2Math
|
|
669
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
670
670
|
describe('vec2Math', () => {
|
|
671
671
|
it('add', () => {
|
|
672
672
|
const r = vec2Math.add({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
@@ -712,9 +712,9 @@ describe('vec2Math', () => {
|
|
|
712
712
|
});
|
|
713
713
|
});
|
|
714
714
|
|
|
715
|
-
//
|
|
716
|
-
// math
|
|
717
|
-
//
|
|
715
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
716
|
+
// math — vec3Math
|
|
717
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
718
718
|
describe('vec3Math', () => {
|
|
719
719
|
it('zero / one factory functions', () => {
|
|
720
720
|
expect(vec3Math.zero()).toEqual({ x: 0, y: 0, z: 0 });
|
|
@@ -776,9 +776,9 @@ describe('vec3Math', () => {
|
|
|
776
776
|
});
|
|
777
777
|
});
|
|
778
778
|
|
|
779
|
-
//
|
|
780
|
-
// math
|
|
781
|
-
//
|
|
779
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
780
|
+
// math — quatMath
|
|
781
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
782
782
|
describe('quatMath', () => {
|
|
783
783
|
it('identity quaternion', () => {
|
|
784
784
|
const q = quatMath.identity();
|
|
@@ -827,9 +827,9 @@ describe('quatMath', () => {
|
|
|
827
827
|
});
|
|
828
828
|
});
|
|
829
829
|
|
|
830
|
-
//
|
|
831
|
-
// math
|
|
832
|
-
//
|
|
830
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
831
|
+
// math — aabbMath
|
|
832
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
833
833
|
describe('aabbMath', () => {
|
|
834
834
|
const box = { min: { x: 0, y: 0, z: 0 }, max: { x: 2, y: 2, z: 2 } };
|
|
835
835
|
|
|
@@ -875,9 +875,9 @@ describe('aabbMath', () => {
|
|
|
875
875
|
});
|
|
876
876
|
});
|
|
877
877
|
|
|
878
|
-
//
|
|
879
|
-
// math
|
|
880
|
-
//
|
|
878
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
879
|
+
// math — noise
|
|
880
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
881
881
|
describe('noise', () => {
|
|
882
882
|
it('perlin2d returns value in range', () => {
|
|
883
883
|
const v = noise.perlin2d(0.5, 0.5);
|
|
@@ -912,9 +912,9 @@ describe('noise', () => {
|
|
|
912
912
|
});
|
|
913
913
|
});
|
|
914
914
|
|
|
915
|
-
//
|
|
916
|
-
// math
|
|
917
|
-
//
|
|
915
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
916
|
+
// math — random
|
|
917
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
918
918
|
describe('random', () => {
|
|
919
919
|
it('float returns [0,1)', () => {
|
|
920
920
|
for (let i = 0; i < 20; i++) {
|
|
@@ -976,10 +976,10 @@ describe('random', () => {
|
|
|
976
976
|
});
|
|
977
977
|
});
|
|
978
978
|
|
|
979
|
-
//
|
|
979
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
980
980
|
// string utilities
|
|
981
|
-
//
|
|
982
|
-
describe('string
|
|
981
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
982
|
+
describe('string — case conversion', () => {
|
|
983
983
|
it('capitalize', () => expect(capitalize('hello world')).toBe('Hello world'));
|
|
984
984
|
it('titleCase', () => expect(titleCase('hello world')).toBe('Hello World'));
|
|
985
985
|
it('camelCase', () => expect(camelCase('hello world')).toBe('helloWorld'));
|
|
@@ -989,7 +989,7 @@ describe('string — case conversion', () => {
|
|
|
989
989
|
it('constantCase', () => expect(constantCase('helloWorld')).toBe('HELLO_WORLD'));
|
|
990
990
|
});
|
|
991
991
|
|
|
992
|
-
describe('string
|
|
992
|
+
describe('string — padding and truncation', () => {
|
|
993
993
|
it('padLeft', () => expect(padLeft('hi', 5)).toBe(' hi'));
|
|
994
994
|
it('padRight', () => expect(padRight('hi', 5)).toBe('hi '));
|
|
995
995
|
it('center', () => {
|
|
@@ -1007,7 +1007,7 @@ describe('string — padding and truncation', () => {
|
|
|
1007
1007
|
});
|
|
1008
1008
|
});
|
|
1009
1009
|
|
|
1010
|
-
describe('string
|
|
1010
|
+
describe('string — checks', () => {
|
|
1011
1011
|
it('isBlank / isNotBlank', () => {
|
|
1012
1012
|
expect(isBlank('')).toBe(true);
|
|
1013
1013
|
expect(isBlank(' ')).toBe(true);
|
|
@@ -1049,7 +1049,7 @@ describe('string — checks', () => {
|
|
|
1049
1049
|
});
|
|
1050
1050
|
});
|
|
1051
1051
|
|
|
1052
|
-
describe('string
|
|
1052
|
+
describe('string — manipulation', () => {
|
|
1053
1053
|
it('repeat', () => expect(repeat('ab', 3)).toBe('ababab'));
|
|
1054
1054
|
it('reverse', () => expect(reverse('hello')).toBe('olleh'));
|
|
1055
1055
|
it('count occurrences', () => expect(count('hello world hello', 'hello')).toBe(2));
|
|
@@ -1061,7 +1061,7 @@ describe('string — manipulation', () => {
|
|
|
1061
1061
|
it('unwrap', () => expect(unwrap('"hello"', '"')).toBe('hello'));
|
|
1062
1062
|
});
|
|
1063
1063
|
|
|
1064
|
-
describe('string
|
|
1064
|
+
describe('string — splitting', () => {
|
|
1065
1065
|
it('lines splits by newline', () => {
|
|
1066
1066
|
const l = lines('a\nb\nc');
|
|
1067
1067
|
expect(l).toEqual(['a', 'b', 'c']);
|
|
@@ -1075,7 +1075,7 @@ describe('string — splitting', () => {
|
|
|
1075
1075
|
});
|
|
1076
1076
|
});
|
|
1077
1077
|
|
|
1078
|
-
describe('string
|
|
1078
|
+
describe('string — formatting', () => {
|
|
1079
1079
|
it('format substitutes named placeholders', () => {
|
|
1080
1080
|
const result = format('Hello {name}, you are {age}!', { name: 'World', age: 42 });
|
|
1081
1081
|
expect(result).toContain('World');
|
|
@@ -1093,7 +1093,7 @@ describe('string — formatting', () => {
|
|
|
1093
1093
|
});
|
|
1094
1094
|
});
|
|
1095
1095
|
|
|
1096
|
-
describe('string
|
|
1096
|
+
describe('string — escaping', () => {
|
|
1097
1097
|
it('escapeHtml / unescapeHtml', () => {
|
|
1098
1098
|
const escaped = escapeHtml('<b>hello</b>');
|
|
1099
1099
|
expect(escaped).toContain('<');
|
|
@@ -1111,7 +1111,7 @@ describe('string — escaping', () => {
|
|
|
1111
1111
|
});
|
|
1112
1112
|
});
|
|
1113
1113
|
|
|
1114
|
-
describe('string
|
|
1114
|
+
describe('string — similarity', () => {
|
|
1115
1115
|
it('levenshtein', () => {
|
|
1116
1116
|
expect(levenshtein('kitten', 'sitting')).toBeGreaterThan(0);
|
|
1117
1117
|
expect(levenshtein('abc', 'abc')).toBe(0);
|
|
@@ -1128,7 +1128,7 @@ describe('string — similarity', () => {
|
|
|
1128
1128
|
});
|
|
1129
1129
|
});
|
|
1130
1130
|
|
|
1131
|
-
describe('string
|
|
1131
|
+
describe('string — indentation', () => {
|
|
1132
1132
|
it('indent adds prefix', () => {
|
|
1133
1133
|
const s = indent('a\nb', 2);
|
|
1134
1134
|
expect(s).toContain(' a');
|
|
@@ -1149,7 +1149,7 @@ describe('string — indentation', () => {
|
|
|
1149
1149
|
});
|
|
1150
1150
|
});
|
|
1151
1151
|
|
|
1152
|
-
describe('string
|
|
1152
|
+
describe('string — generation', () => {
|
|
1153
1153
|
it('randomString generates string of given length', () => {
|
|
1154
1154
|
const s = randomString(10);
|
|
1155
1155
|
expect(s.length).toBe(10);
|
|
@@ -1162,9 +1162,9 @@ describe('string — generation', () => {
|
|
|
1162
1162
|
});
|
|
1163
1163
|
});
|
|
1164
1164
|
|
|
1165
|
-
//
|
|
1165
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
1166
1166
|
// time utilities
|
|
1167
|
-
//
|
|
1167
|
+
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
1168
1168
|
describe('now', () => {
|
|
1169
1169
|
it('returns number', () => {
|
|
1170
1170
|
expect(typeof now()).toBe('number');
|