Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chaosrouter

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chaosrouter - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

54

chaosrouter.js

@@ -43,3 +43,3 @@

this.basepath = setdefault(opts.basepath, '/');
this.defaultExec = setdefault(opts.defaultExec, null);
this.defaultExec = opts.defaultExec;

@@ -56,2 +56,3 @@ if (opts.defaultExec === undefined)

}
ChaosRouter.directivePrefix = '#_';
ChaosRouter.prototype.__directives__ = {};

@@ -135,3 +136,3 @@ ChaosRouter.prototype.directive = function (name, fn) {

for (var k in data) {
if (k.indexOf('#_') === 0) {
if (k.indexOf(ChaosRouter.directivePrefix) === 0) {
directives[k.slice(2)] = data[k];

@@ -167,5 +168,6 @@ delete data[k];

this.__methods__ = router.__methods__;
this.defaultExec = router.defaultExec;
this.args = {};
this.directives = directives;
if (this.directives['execute'] === undefined)
this.directives['execute'] = [[router.defaultExec]];
}

@@ -260,20 +262,25 @@ Endpoint.prototype.directive = function (name, fn) {

};
try {
cmd = eval("self.__methods__."+exec);
} catch (err) {
return Promise.reject(err);
}
if (typeof cmd !== 'function')
throw new Error("'"+cmd+"' is not a function. Found type '"+(typeof cmd)+"'");
if (typeof exec === 'function')
cmd = exec;
else {
args = this.recursiveFill(args, this);
cmd.call(self, args, resp, function (check) {
if (check === true)
next();
else
resp(validationErrorResponse(check, exec));
});
try {
cmd = eval("self.__methods__."+exec);
} catch (err) {
return resp({
"error": err.name,
"message": err.message
});
}
if (typeof cmd !== 'function')
throw Error("'"+cmd+"' is not a function. Found type '"+(typeof cmd)+"'");
}
args = this.recursiveFill(args, this);
cmd.call(this, args, resp, function (check) {
if (check === true)
next();
else
resp(validationErrorResponse(check, exec));
});
}

@@ -344,10 +351,5 @@ Endpoint.prototype.runAll = function(executables, cb) {

return f(error);
var execute = self.directives['execute'];
if ( execute )
self.runAll(execute, f);
else
self.defaultExec.call(self, [], f);
self.runAll(self.directives['execute'], f);
});
}, f);
}, f).catch(r);
});

@@ -354,0 +356,0 @@ }

{
"name": "chaosrouter",
"version": "0.2.1",
"version": "0.2.2",
"description": "ERROR: No README data found!",

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

@@ -132,4 +132,5 @@

function test_endpoint( endpoint, data, cb ) {
if (data)
extend(data, { "db": test_endpoint.db });
if (!data)
data = {};
extend(data, { "db": test_endpoint.db });

@@ -262,6 +263,8 @@ tests.push(new Promise(function(f,r) {

trx.commit();
log.info("Waiting for", tests.length, "to be fullfilled")
return Promise.all(tests);
}).then(function(all) {
return Promise.all(tests).then(function(all) {
// trx.commit();
// return Promise.resolve();
});
}).then(function() {
log.info("Passes", passes);

@@ -272,2 +275,3 @@ log.error("Failures", failures);

}, function(err) {
log.error("Refject failure");
log.error(err);

@@ -274,0 +278,0 @@ knex.destroy();

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