trek-router
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -17,5 +17,5 @@ "use strict"; | ||
var SNODE = 0; | ||
var PNODE = 1; | ||
var ANODE = 2; | ||
var SNODE = 0; // static route | ||
var PNODE = 1; // param route | ||
var ANODE = 2; // all star route | ||
@@ -93,3 +93,3 @@ var Node = (function () { | ||
value: function insert(method, path, handler, has) { | ||
var cn = this.trees[method]; | ||
var cn = this.trees[method]; // Current node as root | ||
var search = path; | ||
@@ -135,11 +135,8 @@ | ||
var e = cn.findEdge(search[0]); | ||
if (!e) { | ||
var n = new Node(search, has, null, null); | ||
if (handler) { | ||
n.handler = handler; | ||
} | ||
if (e) { | ||
cn = e; | ||
} else { | ||
var n = new Node(search, has, handler, null, null); | ||
cn.edges.push(n); | ||
break; | ||
} else { | ||
cn = e; | ||
} | ||
@@ -146,0 +143,0 @@ } else { |
{ | ||
"name": "trek-router", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A fast HTTP router router", | ||
@@ -5,0 +5,0 @@ "repository": "trekjs/router", |
10228
202