Socket
Socket
Sign inDemoInstall

rttc

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rttc - npm Package Compare versions

Comparing version 9.2.1 to 9.2.2

45

lib/get-path-info.js

@@ -19,4 +19,15 @@ /**

*
* @param {*} schema
* @return {{}}
*
* @param {*} schema - an exemplar or type schema
* @param {String} path - a valid dot-deliminited path, where empty string ('') is the root (e.g. "" or "foo" or "foo.bar" or "foo.0.bar.0.baz")
*
* @returns {Dictionary}
* @property {*} exemplar
* @property {Boolean} optional
*
* @throws E_MALFORMED_PATH
* If keypath is invalid for the provided schema
*
* @throws E_UNREACHABLE
* if keypath is unreachable (meaning it is not allowed in the schema)
*/

@@ -43,3 +54,7 @@ module.exports = function getPathInfo (schema, path) {

// something funny is going on.
throw new Error('Invalid keypath: "'+path+'" (non-numeric hop `'+hop+'` is not a valid array index)');
throw (function (){
var err = new Error('Malformed keypath: "'+path+'" (non-numeric hop `'+hop+'` is not a valid array index)');
err.code = 'E_MALFORMED_PATH';
return err;
})();
}

@@ -56,3 +71,7 @@

if (_.isUndefined(currentExemplar[0])) {
throw new Error('Invalid keypath: "'+path+'" (unreachable in schema)');
throw (function (){
var err = new Error('Keypath: "'+path+'" is unreachable in schema');
err.code = 'E_UNREACHABLE';
return err;
})();
}

@@ -74,3 +93,7 @@ else {

if (_.isUndefined(currentExemplar[hop])) {
throw new Error('Invalid keypath: "'+path+'" (unreachable in schema)');
throw (function (){
var err = new Error('Keypath: "'+path+'" is unreachable in schema');
err.code = 'E_UNREACHABLE';
return err;
})();
}

@@ -96,3 +119,7 @@ else {

else if (TYPES.lamda.isExemplar(currentExemplar)) {
throw new Error('Invalid keypath: "'+path+'" (unreachable in schema)');
throw (function (){
var err = new Error('Keypath: "'+path+'" is unreachable in schema');
err.code = 'E_UNREACHABLE';
return err;
})();
}

@@ -102,3 +129,7 @@

else {
throw new Error('Invalid keypath: "'+path+'" (unreachable in schema)');
throw (function (){
var err = new Error('Keypath: "'+path+'" is unreachable in schema');
err.code = 'E_UNREACHABLE';
return err;
})();
}

@@ -105,0 +136,0 @@ });

2

package.json
{
"name": "rttc",
"version": "9.2.1",
"version": "9.2.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