@hestia-earth/schema-convert
Advanced tools
Comparing version 7.8.0 to 7.9.0
34
json.js
@@ -154,4 +154,5 @@ "use strict"; | ||
}; | ||
var schemaNotFoundError = function () { return exports.throwCSVError({ | ||
message: 'schema-not-found' | ||
var schemaNotFoundError = function (schema) { return exports.throwCSVError({ | ||
message: 'schema-not-found', | ||
schema: schema | ||
}); }; | ||
@@ -223,3 +224,11 @@ var propertyNotFoundError = function (schema, key, value) { return exports.throwCSVError({ | ||
integer: function (value) { return isEmptyCell(value) ? undefined : +value; }, | ||
boolean: function (value) { return isEmptyCell(value) ? undefined : value.toLowerCase() === 'true'; }, | ||
boolean: function (value) { | ||
return isEmptyCell(value) ? | ||
undefined : | ||
utils_1.isBoolean(value) ? | ||
value.toLowerCase() === 'true' : | ||
(function () { | ||
throw new Error('failed to parse boolean, expected true or false'); | ||
})(); | ||
}, | ||
object: function (value, schemas, _a, _i) { | ||
@@ -330,3 +339,3 @@ var $ref = _a.$ref, required = _a.required; | ||
if (top === void 0) { top = false; } | ||
var schema = type in schemas ? schemas[type] : schemaNotFoundError(); | ||
var schema = type in schemas ? schemas[type] : schemaNotFoundError(type); | ||
var content = mapContent(schemas, schema, ignoreInternal)(data); | ||
@@ -353,7 +362,12 @@ return utils_1.reduceUndefinedValues(__assign({ id: isEmptyCell(data.id) ? undefined : data.id }, extendDataFromSchema(content, schema, type, ignoreInternal, top)), true); | ||
*/ | ||
exports.toJson = function (schemas, content) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, csvtojson({ delimiter: 'auto' }).fromString(content)]; | ||
case 1: return [2 /*return*/, (_a.sent()).flatMap(convetToNode(schemas))]; | ||
} | ||
}); }); }; | ||
exports.toJson = function (schemas, content) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, csvtojson({ | ||
delimiter: 'auto', | ||
ignoreColumns: /^$/ | ||
}).fromString(content)]; | ||
case 1: return [2 /*return*/, (_a.sent()).flatMap(convetToNode(schemas))]; | ||
} | ||
}); | ||
}); }; |
{ | ||
"name": "@hestia-earth/schema-convert", | ||
"version": "7.8.0", | ||
"version": "7.9.0", | ||
"description": "Hestia Schema Converters", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48117
1019