@requestnetwork/data-format
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.8.3](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/data-format@0.8.0...@requestnetwork/data-format@0.8.3) (2021-02-22) | ||
### Bug Fixes | ||
* enable tree-shaking on data-format ([#411](https://github.com/RequestNetwork/requestNetwork/issues/411)) ([c6e34ed](https://github.com/RequestNetwork/requestNetwork/commit/c6e34edc74417456fdec91a280a6a5905babffaf)) | ||
## [0.8.2](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/data-format@0.8.0...@requestnetwork/data-format@0.8.2) (2020-12-22) | ||
@@ -8,0 +19,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// JSON Schema of an address | ||
const schemaAddress = require("./format/address.json"); | ||
/* eslint-disable spellcheck/spell-checker */ | ||
// another json validation tool from https://github.com/epoberezkin/ajv | ||
const AJV = require("ajv"); | ||
/* eslint-disable spellcheck/spell-checker */ | ||
const jsonSchema = require("ajv/lib/refs/json-schema-draft-06.json"); | ||
const schemaAddress = require("./format/address.json"); | ||
const format_1 = require("./format"); | ||
exports.default = { | ||
@@ -16,5 +15,4 @@ /** | ||
validate(data) { | ||
const validationTool = new AJV() | ||
.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json')) | ||
.addSchema(schemaAddress); | ||
var _a; | ||
const validationTool = new AJV().addMetaSchema(jsonSchema).addSchema(schemaAddress); | ||
// Check the meta information | ||
@@ -31,7 +29,4 @@ if (!data.meta) { | ||
// Try to retrieve the schema json | ||
let schema; | ||
try { | ||
schema = require(`./format/${data.meta.format}/${data.meta.format}-${data.meta.version}.json`); | ||
} | ||
catch (e) { | ||
const schema = (_a = format_1.default[data.meta.format]) === null || _a === void 0 ? void 0 : _a[data.meta.version]; | ||
if (!schema) { | ||
return { valid: false, errors: [{ message: 'format not found' }] }; | ||
@@ -38,0 +33,0 @@ } |
{ | ||
"name": "@requestnetwork/data-format", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"publishConfig": { | ||
@@ -47,3 +47,3 @@ "access": "public" | ||
"devDependencies": { | ||
"@types/node": "14.6.4", | ||
"@types/node": "14.14.16", | ||
"eslint": "7.9.0", | ||
@@ -54,3 +54,3 @@ "eslint-plugin-spellcheck": "0.0.17", | ||
"nyc": "15.1.0", | ||
"prettier": "2.1.1", | ||
"prettier": "2.2.1", | ||
"rimraf": "3.0.2", | ||
@@ -60,5 +60,5 @@ "shx": "0.3.2", | ||
"tslint": "6.1.3", | ||
"typescript": "4.0.2" | ||
"typescript": "4.1.3" | ||
}, | ||
"gitHead": "33e03b7de318e652027ced233c480d5922018185" | ||
"gitHead": "f73144db7ee4d59d2af78b8cf15aeb8b9be207ec" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
45146
16
657
0