5etools-utils 0.9.26 → 0.9.27
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/lib/TestJson.js +18 -0
- package/package.json +4 -3
package/lib/TestJson.js
CHANGED
|
@@ -6,6 +6,7 @@ import {Worker} from "worker_threads";
|
|
|
6
6
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
7
7
|
import addFormats from "ajv-formats";
|
|
8
8
|
import * as jsonSourceMap from "json-source-map";
|
|
9
|
+
import NP from "number-precision";
|
|
9
10
|
|
|
10
11
|
import * as Uf from "./UtilFs.js";
|
|
11
12
|
import Um from "./UtilMisc.js";
|
|
@@ -69,6 +70,23 @@ class JsonTester {
|
|
|
69
70
|
);
|
|
70
71
|
// endregion
|
|
71
72
|
|
|
73
|
+
// region Patch AJV `"multipleOf"`
|
|
74
|
+
// See: https://github.com/ajv-validator/ajv/issues/652#issuecomment-944202626
|
|
75
|
+
this._ajv.removeKeyword("multipleOf");
|
|
76
|
+
|
|
77
|
+
this._ajv.addKeyword({
|
|
78
|
+
keyword: "multipleOf",
|
|
79
|
+
type: "number",
|
|
80
|
+
compile (schema) {
|
|
81
|
+
return (data) => Number.isInteger(NP.divide(data, schema));
|
|
82
|
+
},
|
|
83
|
+
errors: false,
|
|
84
|
+
metaSchema: {
|
|
85
|
+
type: "number",
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
// endregion
|
|
89
|
+
|
|
72
90
|
this._isSchemaLoaded = false;
|
|
73
91
|
}
|
|
74
92
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5etools-utils",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.27",
|
|
4
4
|
"description": "Shared utilities for the 5etools ecosystem.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/Api.js",
|
|
@@ -35,11 +35,12 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/TheGiddyLimit/5etools-utils#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"ajv": "^8.
|
|
38
|
+
"ajv": "^8.12.0",
|
|
39
39
|
"ajv-formats": "^2.1.1",
|
|
40
40
|
"commander": "^9.4.1",
|
|
41
41
|
"hasha": "^5.2.2",
|
|
42
|
-
"json-source-map": "^0.6.1"
|
|
42
|
+
"json-source-map": "^0.6.1",
|
|
43
|
+
"number-precision": "^1.6.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"eslint": "^8.11.0",
|