@fgv/ts-json-base 5.0.1-1 → 5.0.1-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.
|
@@ -42,7 +42,7 @@ exports.jsonPrimitive = new ts_utils_1.Conversion.BaseConverter((from, __self, c
|
|
|
42
42
|
}
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
|
-
return (0, ts_utils_1.fail)(`"${String(from)}":
|
|
45
|
+
return (0, ts_utils_1.fail)(`"${String(from)}": invalid JSON primitive.`);
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* An copying converter which converts a supplied `unknown` value into
|
|
@@ -55,7 +55,7 @@ exports.jsonPrimitive = new ts_utils_1.Conversion.BaseConverter((from, __self, c
|
|
|
55
55
|
*/
|
|
56
56
|
exports.jsonObject = new ts_utils_1.Conversion.BaseConverter((from, __self, ctx) => {
|
|
57
57
|
if (!(0, json_1.isJsonObject)(from)) {
|
|
58
|
-
return (0, ts_utils_1.fail)('
|
|
58
|
+
return (0, ts_utils_1.fail)('invalid JSON object.');
|
|
59
59
|
}
|
|
60
60
|
const obj = {};
|
|
61
61
|
const errors = [];
|
|
@@ -76,7 +76,7 @@ exports.jsonObject = new ts_utils_1.Conversion.BaseConverter((from, __self, ctx)
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
if (errors.length > 0) {
|
|
79
|
-
return (0, ts_utils_1.fail)(`
|
|
79
|
+
return (0, ts_utils_1.fail)(`invalid JSON object:\n${errors.join('\n')}`);
|
|
80
80
|
}
|
|
81
81
|
return (0, ts_utils_1.succeed)(obj);
|
|
82
82
|
});
|
|
@@ -47,7 +47,7 @@ exports.jsonPrimitive = new ts_utils_1.Validation.Base.GenericValidator({
|
|
|
47
47
|
if (from === undefined && (ctx === null || ctx === void 0 ? void 0 : ctx.ignoreUndefinedProperties) === true) {
|
|
48
48
|
return true;
|
|
49
49
|
}
|
|
50
|
-
return (0, ts_utils_1.fail)(`"${String(from)}":
|
|
50
|
+
return (0, ts_utils_1.fail)(`"${String(from)}": invalid JSON primitive.`);
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
/**
|
|
@@ -60,7 +60,7 @@ exports.jsonPrimitive = new ts_utils_1.Validation.Base.GenericValidator({
|
|
|
60
60
|
exports.jsonObject = new ts_utils_1.Validation.Base.GenericValidator({
|
|
61
61
|
validator: (from, ctx, self) => {
|
|
62
62
|
if (!(0, json_1.isJsonObject)(from)) {
|
|
63
|
-
return (0, ts_utils_1.fail)('
|
|
63
|
+
return (0, ts_utils_1.fail)('invalid JSON object.');
|
|
64
64
|
}
|
|
65
65
|
const errors = [];
|
|
66
66
|
for (const [name, value] of Object.entries(from)) {
|
|
@@ -70,7 +70,7 @@ exports.jsonObject = new ts_utils_1.Validation.Base.GenericValidator({
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
if (errors.length > 0) {
|
|
73
|
-
return (0, ts_utils_1.fail)(`
|
|
73
|
+
return (0, ts_utils_1.fail)(`invalid JSON object:\n${errors.join('\n')}`);
|
|
74
74
|
}
|
|
75
75
|
return true;
|
|
76
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-json-base",
|
|
3
|
-
"version": "5.0.1-
|
|
3
|
+
"version": "5.0.1-2",
|
|
4
4
|
"description": "Typescript types and basic functions for working with json",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "dist/ts-json-base.d.ts",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@rushstack/eslint-config": "4.4.0",
|
|
54
54
|
"eslint-plugin-tsdoc": "~0.4.0",
|
|
55
55
|
"@types/luxon": "^3.7.1",
|
|
56
|
-
"@fgv/ts-utils": "5.0.1-
|
|
57
|
-
"@fgv/ts-utils
|
|
56
|
+
"@fgv/ts-utils-jest": "5.0.1-2",
|
|
57
|
+
"@fgv/ts-utils": "5.0.1-2"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@fgv/ts-utils": "5.0.1-
|
|
60
|
+
"@fgv/ts-utils": "5.0.1-2"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"luxon": "^3.7.2"
|