Socket
Socket
Sign inDemoInstall

jsprim

Package Overview
Dependencies
3
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.2.2

5

CHANGES.md

@@ -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 @@

41

lib/jsprim.js

@@ -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 @@ {

2

package.json
{
"name": "jsprim",
"version": "1.2.1",
"version": "1.2.2",
"description": "utilities for primitive JavaScript types",

@@ -5,0 +5,0 @@ "main": "./lib/jsprim.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc