chaosrouter
Advanced tools
Comparing version 0.2.16 to 0.2.17
@@ -104,3 +104,4 @@ | ||
} | ||
ChaosRouter.directivePrefix = '#_'; | ||
ChaosRouter.directivePrefix = '__'; | ||
ChaosRouter.directiveSuffix = '__'; | ||
ChaosRouter.prototype.__directives__ = {}; | ||
@@ -141,4 +142,6 @@ ChaosRouter.prototype.directive = function (name, fn) { | ||
for (var k in data) { | ||
if (k.indexOf(ChaosRouter.directivePrefix) === 0) { | ||
var name = k.slice(ChaosRouter.directivePrefix.length); | ||
var noprefix = k.slice(ChaosRouter.directivePrefix.length); | ||
if ( k.indexOf(ChaosRouter.directivePrefix) === 0 | ||
&& noprefix.indexOf(ChaosRouter.directiveSuffix) === (noprefix.length - ChaosRouter.directiveSuffix.length)) { | ||
var name = k.slice(ChaosRouter.directivePrefix.length, -ChaosRouter.directiveSuffix.length); | ||
directives[name] = data[k]; | ||
@@ -162,3 +165,3 @@ delete data[k]; | ||
var validateKey = ChaosRouter.directivePrefix+'validate'; | ||
var validateKey = ChaosRouter.directivePrefix+'validate'+ChaosRouter.directiveSuffix; | ||
var validates = data[validateKey] || []; | ||
@@ -196,3 +199,3 @@ for (var i in segs) { | ||
variables[vkey.slice(1)] = seg; | ||
variables[vkey.slice(1)] = unescape(seg); | ||
jsonkeys.push(vkey); | ||
@@ -246,3 +249,3 @@ } | ||
this.path = path; | ||
this.path = path_vars; | ||
this.path_vars = path_vars; | ||
this.router = router; | ||
@@ -292,2 +295,6 @@ this.config = config; | ||
} | ||
Endpoint.prototype.explode = function(args, fn, context) { | ||
var ctx = context || this; | ||
return fn.apply(ctx, args); | ||
} | ||
Endpoint.prototype.method = function() { | ||
@@ -307,2 +314,6 @@ var args = Array.prototype.slice.call(arguments); | ||
return new Promise(function(f,r) { | ||
if (!endpoint) | ||
r({ error: "Dead End", | ||
message: "Respond endpoint '"+path+"' does not exist." }); | ||
endpoint.execute(extend({}, self.args)) | ||
@@ -309,0 +320,0 @@ .then(function(d) { |
{ | ||
"name": "chaosrouter", | ||
"version": "0.2.16", | ||
"version": "0.2.17", | ||
"description": "ERROR: No README data found!", | ||
@@ -23,4 +23,3 @@ "main": "chaosrouter.js", | ||
"populater": "^0.2.2", | ||
"promise": "^7.0.4", | ||
"restruct-data": "^0.2.10" | ||
"promise": "^7.0.4" | ||
}, | ||
@@ -27,0 +26,0 @@ "devDependencies": { |
21888
3
727
- Removedrestruct-data@^0.2.10
- Removedrestruct-data@0.2.10(transitive)