You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

rttc

Package Overview
Dependencies
1
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.6.1 to 9.6.2

26

lib/validate-exemplar-strict.js

@@ -19,2 +19,5 @@ /**

* @throws {Error} If the provided `supposedExemplar` is not a pure RTTC exemplar.
* @property {String} code
* The error intentionally thrown from here always has a `code`
* property of `E_INVALID_EXEMPLAR`.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@@ -34,8 +37,15 @@ * Example usage:

// Used below.
var err;
// Check for obvious bad news.
if (_.isUndefined(supposedExemplar)) {
throw new Error('Invalid exemplar: `undefined` is not a valid RTTC exemplar.');
err = new Error('Invalid exemplar: `undefined` is not a valid RTTC exemplar.');
err.code = 'E_INVALID_EXEMPLAR';
throw err;
}
if (_.isNull(supposedExemplar)) {
throw new Error('Invalid exemplar: `null` is not a valid RTTC exemplar.');
err = new Error('Invalid exemplar: `null` is not a valid RTTC exemplar.');
err.code = 'E_INVALID_EXEMPLAR';
throw err;
}

@@ -46,3 +56,5 @@

if (_.isNull(val)) {
throw new Error('Invalid exemplar: Nested `null`s are not allowed in an RTTC exemplar.');
err = new Error('Invalid exemplar: Nested `null`s are not allowed in an RTTC exemplar.');
err.code = 'E_INVALID_EXEMPLAR';
throw err;
}

@@ -52,3 +64,5 @@ return val;

if (type === 'array' && val.length > 1) {
throw new Error('Invalid exemplar: Nested `null`s are not allowed in an RTTC exemplar.');
err = new Error('Invalid exemplar: Nested `null`s are not allowed in an RTTC exemplar.');
err.code = 'E_INVALID_EXEMPLAR';
throw err;
}

@@ -62,5 +76,7 @@ return val;

if (!_.isEqual(supposedExemplar, rebuiltExemplar)) {
throw new Error('Invalid exemplar: Only strictly JSON-serializable values can qualify to be RTTC exemplars.');
err = new Error('Invalid exemplar: Only strictly JSON-serializable values can qualify to be RTTC exemplars.');
err.code = 'E_INVALID_EXEMPLAR';
throw err;
}
};

2

package.json
{
"name": "rttc",
"version": "9.6.1",
"version": "9.6.2",
"description": "Runtime type-checking for JavaScript.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc