five-bells-shared
Advanced tools
Comparing version 21.0.0 to 21.0.1
{ | ||
"name": "five-bells-shared", | ||
"version": "21.0.0", | ||
"version": "21.0.1", | ||
"description": "Shared components for Five Bells projects.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,23 +5,10 @@ 'use strict' | ||
const fs = require('fs') | ||
const path = require('path') | ||
const Ajv = require('ajv') | ||
const ServerError = require('../errors/server-error') | ||
const validator = new Ajv() | ||
const schemas = require('../schemas') | ||
const baseDir = path.join(__dirname, '/../schemas') | ||
for (const schemaId in schemas) { | ||
validator.addSchema(schemas[schemaId], schemaId + '.json') | ||
} | ||
fs.readdirSync(baseDir) | ||
.filter(function (fileName) { | ||
return /^[\w\s]+\.json$/.test(fileName) | ||
}) | ||
.forEach(function (fileName) { | ||
try { | ||
validator.addSchema(require(path.join(baseDir, fileName)), fileName) | ||
} catch (e) { | ||
throw new ServerError('Failed to parse schema: ' + fileName) | ||
} | ||
}) | ||
function validate (schemaId, json) { | ||
@@ -28,0 +15,0 @@ const isValid = validator.validate(schemaId + '.json', json) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3124744
179
5371
86