@oliversalzburg/js-utils 0.0.3 → 0.0.5
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/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/bundle.js +30 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +16 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/spa.css +298 -0
- package/coverage/string-formatter.ts.html +187 -0
- package/coverage/tmp/coverage-4186-1699218521999-0.json +1 -0
- package/coverage/tmp/coverage-4196-1699218521967-0.json +1 -0
- package/docs/README.md +3 -0
- package/docs/classes/AbstractError.md +271 -0
- package/docs/classes/Canvas.md +177 -0
- package/docs/classes/InternalError.md +301 -0
- package/docs/classes/InvalidArgumentError.md +277 -0
- package/docs/classes/InvalidOperationError.md +277 -0
- package/docs/classes/NotImplementedError.md +276 -0
- package/docs/classes/PermissionViolationError.md +277 -0
- package/docs/classes/Random.md +109 -0
- package/docs/classes/RenderLoop.md +49 -0
- package/docs/classes/ResourceConflictError.md +276 -0
- package/docs/classes/UnexpectedNilError.md +169 -0
- package/docs/classes/UnknownError.md +280 -0
- package/docs/classes/Vector2.md +79 -0
- package/docs/classes/Vector3.md +106 -0
- package/docs/modules.md +1313 -0
- package/mkdocs.yml +52 -0
- package/output/core.d.ts +18 -1
- package/output/core.js +1 -0
- package/output/core.js.map +1 -1
- package/output/error-serializer.d.ts +37 -0
- package/output/error-serializer.js +63 -0
- package/output/error-serializer.js.map +1 -0
- package/output/errors/AbstractError.d.ts +42 -0
- package/output/errors/AbstractError.js +70 -0
- package/output/errors/AbstractError.js.map +1 -0
- package/output/errors/InternalError.d.ts +19 -0
- package/output/errors/InternalError.js +38 -0
- package/output/errors/InternalError.js.map +1 -0
- package/output/errors/InvalidArgumentError.d.ts +13 -0
- package/output/errors/InvalidArgumentError.js +20 -0
- package/output/errors/InvalidArgumentError.js.map +1 -0
- package/output/errors/InvalidOperationError.d.ts +13 -0
- package/output/errors/InvalidOperationError.js +20 -0
- package/output/errors/InvalidOperationError.js.map +1 -0
- package/output/errors/NotImplementedError.d.ts +12 -0
- package/output/errors/NotImplementedError.js +19 -0
- package/output/errors/NotImplementedError.js.map +1 -0
- package/output/errors/PermissionViolationError.d.ts +13 -0
- package/output/errors/PermissionViolationError.js +20 -0
- package/output/errors/PermissionViolationError.js.map +1 -0
- package/output/errors/ResourceConflictError.d.ts +12 -0
- package/output/errors/ResourceConflictError.js +19 -0
- package/output/errors/ResourceConflictError.js.map +1 -0
- package/output/errors/UnknownError.d.ts +16 -0
- package/output/errors/UnknownError.js +23 -0
- package/output/errors/UnknownError.js.map +1 -0
- package/output/errors/index.d.ts +8 -0
- package/output/errors/index.js +9 -0
- package/output/errors/index.js.map +1 -0
- package/output/graphics/canvas.d.ts +80 -0
- package/output/graphics/canvas.js +164 -0
- package/output/graphics/canvas.js.map +1 -0
- package/output/graphics/core.d.ts +94 -0
- package/output/graphics/core.js +479 -0
- package/output/graphics/core.js.map +1 -0
- package/output/graphics/index.d.ts +3 -0
- package/output/graphics/index.js +4 -0
- package/output/graphics/index.js.map +1 -0
- package/output/graphics/render-loop.d.ts +20 -0
- package/output/graphics/render-loop.js +51 -0
- package/output/graphics/render-loop.js.map +1 -0
- package/output/index.d.ts +7 -0
- package/output/index.js +7 -0
- package/output/index.js.map +1 -1
- package/output/math/core.d.ts +46 -0
- package/output/math/core.js +72 -0
- package/output/math/core.js.map +1 -0
- package/output/math/index.d.ts +2 -0
- package/output/math/index.js +3 -0
- package/output/math/index.js.map +1 -0
- package/output/math/vector.d.ts +33 -0
- package/output/math/vector.js +42 -0
- package/output/math/vector.js.map +1 -0
- package/output/nil.d.ts +13 -8
- package/output/nil.js +16 -11
- package/output/nil.js.map +1 -1
- package/output/random.d.ts +56 -0
- package/output/random.js +184 -0
- package/output/random.js.map +1 -0
- package/output/string-formatter.d.ts +20 -0
- package/output/string-formatter.js +26 -0
- package/output/string-formatter.js.map +1 -0
- package/output/string-formatter.test.d.ts +1 -0
- package/output/string-formatter.test.js +17 -0
- package/output/string-formatter.test.js.map +1 -0
- package/output/vector.d.ts +10 -0
- package/output/vector.js +19 -0
- package/output/vector.js.map +1 -0
- package/package.json +23 -7
- package/typedoc.json +8 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { it } from "mocha";
|
|
3
|
+
import { formatString, formatStringTemplate } from "./string-formatter.js";
|
|
4
|
+
it("formats index-based template strings", () => {
|
|
5
|
+
expect(formatString("'{0}'", "foo")).to.equal("'foo'");
|
|
6
|
+
expect(formatString("'{0}': {1}", "foo", "bar")).to.equal("'foo': bar");
|
|
7
|
+
expect(formatString("'{0}': {1}", "foo")).to.equal("'foo': {1}");
|
|
8
|
+
});
|
|
9
|
+
it("formats literal-based template strings", () => {
|
|
10
|
+
expect(formatStringTemplate("'#{foo}'", { foo: "foo" })).to.equal("'foo'");
|
|
11
|
+
expect(formatStringTemplate("'#{foo}': #{bar}", { foo: "foo", bar: "bar" })).to.equal("'foo': bar");
|
|
12
|
+
expect(formatStringTemplate("'#{foo}': #{bar}", { foo: "foo" })).to.equal("'foo': <missing parameter>");
|
|
13
|
+
});
|
|
14
|
+
it("treats empty string appropriately", () => {
|
|
15
|
+
expect(formatString("'{0}'", "")).to.equal("''");
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=string-formatter.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-formatter.test.js","sourceRoot":"","sources":["../source/string-formatter.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,EAAE,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
this.y = y;
|
|
7
|
+
}
|
|
8
|
+
dot2(x, y) {
|
|
9
|
+
return this.x * x + this.y * y;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class Vector3 extends Vector2 {
|
|
13
|
+
z;
|
|
14
|
+
constructor(x, y, z) {
|
|
15
|
+
super(x, y);
|
|
16
|
+
this.z = z;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=vector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../source/vector.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,OAAO;IAClB,CAAC,CAAS;IACV,CAAC,CAAS;IAEV,YAAY,CAAS,EAAE,CAAS;QAC9B,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAED,IAAI,CAAC,CAAS,EAAE,CAAS;QACvB,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,OAAQ,SAAQ,OAAO;IAClC,CAAC,CAAS;IAEV,YAAY,CAAS,EAAE,CAAS,EAAE,CAAS;QACzC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@oliversalzburg/js-utils",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Oliver Salzburg <oliver.salzburg@gmail.com>",
|
|
7
7
|
"type": "module",
|
|
@@ -17,28 +17,44 @@
|
|
|
17
17
|
"build": "yarn run build:tsc",
|
|
18
18
|
"build:esbuild": "node build.js",
|
|
19
19
|
"build:tsc": "tsc",
|
|
20
|
+
"docs:typedoc": "typedoc --plugin typedoc-plugin-markdown",
|
|
21
|
+
"lint": "yarn run lint:eslint && yarn run lint:prettier && yarn run lint:tsc",
|
|
20
22
|
"lint:eslint": "eslint source ./*js",
|
|
23
|
+
"lint:prettier": "prettier --check source ./*js",
|
|
21
24
|
"lint:tsc": "tsc --noEmit",
|
|
22
25
|
"npm:publish": "npm publish",
|
|
23
26
|
"npm:publish:major": "npm version major && npm publish",
|
|
24
27
|
"npm:publish:minor": "npm version minor && npm publish",
|
|
25
28
|
"npm:publish:patch": "npm version patch && npm publish",
|
|
26
|
-
"prepack": "yarn run build"
|
|
29
|
+
"prepack": "yarn run build",
|
|
30
|
+
"test": "node --enable-source-maps $(yarn bin mocha) ./output/*.test.js",
|
|
31
|
+
"test:coverage": "c8 --reporter html-spa --reporter text node --enable-source-maps $(yarn bin mocha)",
|
|
32
|
+
"test:inspect": "node $(yarn bin mocha) --inspect ./output/*.test.js"
|
|
27
33
|
},
|
|
28
34
|
"types": "./output/index.d.ts",
|
|
29
35
|
"devDependencies": {
|
|
36
|
+
"@types/chai": "4.3.9",
|
|
37
|
+
"@types/chai-as-promised": "7.1.7",
|
|
30
38
|
"@types/eslint": "8.44.6",
|
|
31
|
-
"@types/
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
39
|
+
"@types/mocha": "10.0.3",
|
|
40
|
+
"@types/node": "20.8.10",
|
|
41
|
+
"@types/web": "0.0.119",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "6.9.1",
|
|
43
|
+
"@typescript-eslint/parser": "6.9.1",
|
|
44
|
+
"c8": "8.0.1",
|
|
45
|
+
"chai": "4.3.10",
|
|
46
|
+
"chai-as-promised": "7.1.1",
|
|
34
47
|
"esbuild": "0.19.5",
|
|
35
|
-
"eslint": "8.
|
|
48
|
+
"eslint": "8.53.0",
|
|
36
49
|
"eslint-plugin-jsdoc": "46.8.2",
|
|
37
50
|
"lint-staged": "15.0.2",
|
|
51
|
+
"mocha": "10.2.0",
|
|
38
52
|
"prettier": "3.0.3",
|
|
39
53
|
"prettier-package-json": "2.8.0",
|
|
40
54
|
"prettier-plugin-organize-imports": "3.2.3",
|
|
55
|
+
"typedoc": "0.25.3",
|
|
56
|
+
"typedoc-plugin-markdown": "3.17.0",
|
|
41
57
|
"typescript": "5.2.2"
|
|
42
58
|
},
|
|
43
|
-
"packageManager": "yarn@4.0.
|
|
59
|
+
"packageManager": "yarn@4.0.1"
|
|
44
60
|
}
|