jsprim
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -7,2 +7,7 @@ # Changelog | ||
## v1.2.2 (2015-10-15) | ||
* #11 NPM package shouldn't include any code that does `require('JSV')` | ||
* #12 jsl.node.conf missing definition for "module" | ||
## v1.2.1 (2015-10-14) | ||
@@ -9,0 +14,0 @@ |
@@ -12,4 +12,2 @@ /* | ||
var mod_jsv; /* lazy-loaded because it may not be here */ | ||
/* | ||
@@ -27,3 +25,2 @@ * Public interface | ||
exports.validateJsonObjectJS = validateJsonObjectJS; | ||
exports.validateJsonObjectJSV = validateJsonObjectJSV; | ||
exports.randElt = randElt; | ||
@@ -277,40 +274,2 @@ exports.extraProperties = extraProperties; | ||
function validateJsonObjectJSV(schema, input) | ||
{ | ||
if (!mod_jsv) | ||
mod_jsv = require('JSV'); | ||
var env = mod_jsv.JSV.createEnvironment(); | ||
var report = env.validate(input, schema); | ||
if (report.errors.length === 0) | ||
return (null); | ||
/* Currently, we only do anything useful with the first error. */ | ||
mod_assert.ok(report.errors.length > 0); | ||
var error = report.errors[0]; | ||
/* The failed property is given by a URI with an irrelevant prefix. */ | ||
var propname = error['uri'].substr(error['uri'].indexOf('#') + 2); | ||
var reason; | ||
/* | ||
* Some of the default error messages are pretty arcane, so we define | ||
* new ones here. | ||
*/ | ||
switch (error['attribute']) { | ||
case 'type': | ||
reason = 'expected ' + error['details']; | ||
break; | ||
default: | ||
reason = error['message'].toLowerCase(); | ||
break; | ||
} | ||
var message = reason + ': "' + propname + '"'; | ||
var rv = new Error(message); | ||
rv.jsv_details = error; | ||
return (rv); | ||
} | ||
function validateJsonObjectJS(schema, input) | ||
@@ -317,0 +276,0 @@ { |
{ | ||
"name": "jsprim", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "utilities for primitive JavaScript types", | ||
@@ -5,0 +5,0 @@ "main": "./lib/jsprim.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20580
5
395
1