Socket
Socket
Sign inDemoInstall

jjve

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jjve - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

.travis.yml

46

jjve.js

@@ -44,3 +44,3 @@ (function() {

case 'required':
properties = o.ns.split(o.sep);
properties = o.ns;

@@ -158,3 +158,3 @@ error = {

case 'additional':
properties = o.ns.split(o.sep);
properties = o.ns;

@@ -241,9 +241,6 @@ error = {

var isArray = key.match(/^\d+$/);
var opts = {
env: o.env,
schema: s || {},
ns: o.ns + (isArray ? '[' + key + ']' : (o.sep + key)),
sep: o.sep
ns: o.ns.concat(key)
};

@@ -295,2 +292,26 @@

function formatPath(options) {
var root = options.hasOwnProperty('root') ?
options.root : '$';
var sep = options.hasOwnProperty('sep') ?
options.sep : '.';
return function(error) {
var path = root;
error.path.forEach(function(key) {
path += key.match(/^\d+$/) ?
'[' + key + ']' :
key.match(/^[A-Z_$][0-9A-Z_$]*$/i) ?
(sep + key) :
('[' + JSON.stringify(key) + ']');
});
error.path = path;
return error;
};
}
function jjve(env) {

@@ -302,7 +323,5 @@ return function jjve(schema, data, result, options) {

if (!options.hasOwnProperty('root')) options.root = '$';
if (!options.hasOwnProperty('sep')) options.sep = '.';
if (typeof schema === 'string') { schema = env.schema[schema]; }
return make({
var errors = make({
env: env,

@@ -312,6 +331,11 @@ schema: schema,

validation: result.validation,
sep: options.sep,
ns: options.root,
ns: [],
definitions: schema.definitions || {}
});
if (errors.length && options.formatPath !== false) {
return errors.map(formatPath(options));
}
return errors;
};

@@ -318,0 +342,0 @@ }

{
"name": "jjve",
"version": "0.3.0",
"version": "0.4.0",
"description": "Render JJV errors",
"main": "jjve.js",
"devDependencies": {
"istanbul": "^0.3.0",
"jjv": "^1.0.0",

@@ -8,0 +9,0 @@ "jscs": "^1.4.5",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc