connect-traversal
Advanced tools
Comparing version 0.3.3 to 0.3.4
'use strict'; | ||
var util = require('util'), | ||
Chain = require('./chain'); | ||
var util = require('util') | ||
, Chain = require('./chain'); | ||
@@ -41,8 +41,8 @@ | ||
if(this.children && this.children[key]) { | ||
this.__traversal__.checkResource(this.children[key]); | ||
factory = this.__traversal__.resources[this.children[key]]; | ||
this.traversal_.checkResource(this.children[key]); | ||
factory = this.traversal_.resources[this.children[key]]; | ||
} | ||
else if(this.child && this.childValidate(key)) { | ||
this.__traversal__.checkResource(this.child); | ||
factory = this.__traversal__.resources[this.child]; | ||
this.traversal_.checkResource(this.child); | ||
factory = this.traversal_.resources[this.child]; | ||
} | ||
@@ -65,2 +65,6 @@ return factory ? new factory(key, this) : null; | ||
Resource.prototype.toString = function() { | ||
return util.format('#<Resource[%s]>', this.resource); | ||
}; | ||
/** | ||
@@ -92,20 +96,16 @@ * Traversal object. | ||
Traversal.prototype.registerResource = function(id, proto) { | ||
//Constructor for resource | ||
var obj = function () { | ||
this.resource = id; | ||
var inst = obj.__super__.apply(this, arguments); | ||
var inst = obj.super_.apply(this, arguments); | ||
inst.init(); | ||
return inst; | ||
}; | ||
var Inheritance = function(){}; | ||
Inheritance.prototype = Resource.prototype; | ||
obj.prototype = new Inheritance; | ||
obj.prototype.constructor = obj; | ||
obj.prototype.__traversal__ = this; | ||
obj.__super__ = Resource; | ||
// Inheritance of Resource function class | ||
util.inherits(obj, Resource); | ||
obj.prototype.traversal_ = this; | ||
Object.getOwnPropertyNames(proto).forEach(function(name) { | ||
obj.prototype[name] = proto[name]; | ||
}); | ||
obj.prototype.toString = function() { | ||
return util.format('#<Resource[%s]>', this.resource); | ||
}; | ||
// Registration of Resource obj. | ||
this.resources[id] = obj; | ||
@@ -112,0 +112,0 @@ }; |
{ | ||
"name": "connect-traversal", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Middleware for Connect and Express application which allows to use URL traversal instead of URL dispatching.", | ||
@@ -40,4 +40,4 @@ "keywords": [ | ||
"readmeFilename": "README.md", | ||
"_id": "connect-traversal@0.3.3", | ||
"_id": "connect-traversal@0.3.4", | ||
"_from": "connect-traversal@latest" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
17
1
167
59230
383