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

director

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

director - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

12

lib/director/cli.js
var util = require('util'),
director = require('../director'),
optimist = require('optimist');
director = require('../director');

@@ -47,10 +46,7 @@ var Router = exports.Router = function (routes) {

//
var argv = optimist(path.split(' ')).argv;
path = ' ' + argv._.join(' ');
path = ' ' + path;
var fns = this.traverse(method, path, this.routes, '');
if (!fns || fns.length === 0) {
if (typeof this.notfound === 'function') {
this.invoke([this.notfound], { params: argv, tty: tty, cmd: path }, callback);
this.invoke([this.notfound], { tty: tty, cmd: path }, callback);
}

@@ -68,4 +64,4 @@ else if (callback) {

this.invoke(fns, { params: argv, tty: tty, cmd: path }, callback);
this.invoke(fns, { tty: tty, cmd: path }, callback);
return true;
};

@@ -31,3 +31,3 @@

this._methods = {};
this.recurse = 'backward';
this.recurse = 'forward';

@@ -79,9 +79,12 @@ this.extend(exports.methods.concat(['before', 'after']));

fns = this.traverse(method, req.url, this.routes, ''),
thisArg = { req: req, res: res },
self = this,
runlist,
stream;
stream,
error;
if (!fns || fns.length === 0) {
error = new exports.NotFound('Could not find path: ' + req.url)
if (callback) {
callback(new Error('Could not find path: ' + req.url));
callback.call(thisArg, error);
}

@@ -94,3 +97,3 @@ return false;

}
stream = fns.some(function (fn) { return fn.stream === true });

@@ -100,4 +103,11 @@ runlist = this.runlist(fns);

function parseAndInvoke() {
self.parse(req);
self.invoke(runlist, { req: req, res: res }, callback);
error = self.parse(req);
if (error) {
if (callback) {
callback.call(thisArg, error);
}
return false;
}
self.invoke(runlist, thisArg, callback);
}

@@ -126,3 +136,3 @@

else {
this.invoke(runlist, { req: req, res: res }, callback);
this.invoke(runlist, thisArg, callback);
}

@@ -172,5 +182,3 @@

catch (err) {
//
// Remark: We should probably do something here.
//
return new exports.BadRequest('Malformed data');
}

@@ -177,0 +185,0 @@ }

//
// HTTP Error objectst
//
var util = require('util');

@@ -12,2 +13,4 @@ exports.NotModified = function () {

util.inherits(exports.NotModified, Error);
exports.BadRequest = function (msg) {

@@ -19,2 +22,4 @@ this.status = 400;

util.inherits(exports.BadRequest, Error);
exports.NotAuthorized = function (msg) {

@@ -26,2 +31,4 @@ this.status = 401;

util.inherits(exports.NotAuthorized, Error);
exports.Forbidden = function (msg) {

@@ -33,2 +40,4 @@ this.status = 403;

util.inherits(exports.Forbidden, Error);
exports.NotFound = function (msg) {

@@ -40,2 +49,4 @@ this.status = 404;

util.inherits(exports.NotFound, Error);
exports.MethodNotAllowed = function (allowed) {

@@ -47,2 +58,4 @@ this.status = 405;

util.inherits(exports.MethodNotAllowed, Error);
exports.NotAcceptable = function (accept) {

@@ -57,2 +70,4 @@ this.status = 406;

util.inherits(exports.NotAcceptable, Error);
exports.NotImplemented = function (msg) {

@@ -62,2 +77,4 @@ this.status = 501;

this.body = { error: msg };
};
};
util.inherits(exports.NotImplemented, Error);

@@ -150,3 +150,3 @@ /*

//
this.every = {
this.every = {
after: options.after || null,

@@ -207,3 +207,3 @@ before: options.before || null,

return method.forEach(function (m) {
self.on(m, path, route);
self.on(m.toLowerCase(), path, route);
});

@@ -346,4 +346,5 @@ }

//
if (callback) {
callback.apply(null, arguments);
callback.apply(thisArg, arguments);
}

@@ -419,2 +420,3 @@ });

if (!this.strict) {

@@ -425,3 +427,3 @@ exact += '[' + this.delimiter + ']?';

match = path.match(new RegExp('^' + exact));
if (!match) {

@@ -448,2 +450,8 @@ //

next.captures = match.slice(1);
if (this.recurse && routes === this.routes) {
next.push([routes['before'], routes['on']].filter(Boolean));
next.after = next.after.concat([routes['after']].filter(Boolean))
}
return next;

@@ -476,2 +484,7 @@ }

next.after = next.after.concat([routes[r].after].filter(Boolean));
if (routes === this.routes) {
fns.push([routes['before'], routes['on']].filter(Boolean));
next.after = next.after.concat([routes['after']].filter(Boolean))
}
}

@@ -519,3 +532,3 @@

part = path.shift();
if (/\:|\*/.test(part)) {
if (/\:|\*/.test(part) && !/\\d|\\w/.test(part)) {
part = regifyString(part, this.params);

@@ -522,0 +535,0 @@ }

@@ -5,3 +5,3 @@ {

"author": "Nodejitsu Inc <info@nodejitsu.com>",
"version": "1.0.6",
"version": "1.0.7",
"maintainers": [ "hij1nx <hij1nx@me.com>", "indexzero <charlie.robbins@gmail.com>" ],

@@ -18,5 +18,2 @@ "contributors": [

"keywords": ["URL", "router", "http", "cli", "flatiron", "client side"],
"dependencies": {
"optimist": "0.2.x"
},
"devDependencies": {

@@ -28,3 +25,3 @@ "codesurgeon": "0.2.x",

"request": "2.0.x",
"vows": "0.5.x"
"vows": "0.6.x"
},

@@ -31,0 +28,0 @@ "ender": "./build/ender.js",

Sorry, the diff of this file is not supported yet

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