Skip to content

Commit

Permalink
chore(all): prepare release 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 22, 2015
1 parent 64ba4bd commit 446895b
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 101 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-route-recognizer",
"version": "0.2.1",
"version": "0.2.2",
"description": "A lightweight JavaScript library that matches paths against registered routes. It includes support for dynamic and star segments and nested handlers.",
"keywords": [
"aurelia",
Expand Down
3 changes: 1 addition & 2 deletions dist/amd/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ define(["exports"], function (exports) {

function addRoute(routeArray, path, handler) {
var len = 0;
for (var i = 0,
l = routeArray.length; i < l; i++) {
for (var i = 0, l = routeArray.length; i < l; i++) {
len += routeArray[i].path.length;
}

Expand Down
61 changes: 30 additions & 31 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ define(["exports", "./dsl"], function (exports, _dsl) {
}
StaticSegment.prototype = {
eachChar: function (callback) {
var string = this.string, ch;
var string = this.string,
ch;

for (var i = 0,
l = string.length; i < l; i++) {
for (var i = 0, l = string.length; i < l; i++) {
ch = string.charAt(i);
callback({ validChars: ch });
}
Expand Down Expand Up @@ -88,9 +88,9 @@ define(["exports", "./dsl"], function (exports, _dsl) {
var segments = route.split("/"),
results = [];

for (var i = 0,
l = segments.length; i < l; i++) {
var segment = segments[i], match;
for (var i = 0, l = segments.length; i < l; i++) {
var segment = segments[i],
match;

if (match = segment.match(/^:([^\/]+)$/)) {
results.push(new DynamicSegment(match[1]));
Expand Down Expand Up @@ -120,8 +120,7 @@ define(["exports", "./dsl"], function (exports, _dsl) {
get: function (charSpec) {
var nextStates = this.nextStates;

for (var i = 0,
l = nextStates.length; i < l; i++) {
for (var i = 0, l = nextStates.length; i < l; i++) {
var child = nextStates[i];

var isEqual = child.charSpec.validChars === charSpec.validChars;
Expand Down Expand Up @@ -151,12 +150,14 @@ define(["exports", "./dsl"], function (exports, _dsl) {
return state;
},
match: function (ch) {
var nextStates = this.nextStates, child, charSpec, chars;
var nextStates = this.nextStates,
child,
charSpec,
chars;

var returned = [];

for (var i = 0,
l = nextStates.length; i < l; i++) {
for (var i = 0, l = nextStates.length; i < l; i++) {
child = nextStates[i];

charSpec = child.charSpec;
Expand Down Expand Up @@ -206,8 +207,7 @@ define(["exports", "./dsl"], function (exports, _dsl) {
function recognizeChar(states, ch) {
var nextStates = [];

for (var i = 0,
l = states.length; i < l; i++) {
for (var i = 0, l = states.length; i < l; i++) {
var state = states[i];

nextStates = nextStates.concat(state.match(ch));
Expand All @@ -217,7 +217,8 @@ define(["exports", "./dsl"], function (exports, _dsl) {
}

var oCreate = Object.create || function (proto) {
function F() {}
var F = function () {};

F.prototype = proto;
return new F();
};
Expand All @@ -240,14 +241,12 @@ define(["exports", "./dsl"], function (exports, _dsl) {
currentCapture = 1;
var result = new RecognizeResults(queryParams);

for (var i = 0,
l = handlers.length; i < l; i++) {
for (var i = 0, l = handlers.length; i < l; i++) {
var handler = handlers[i],
names = handler.names,
params = {};

for (var j = 0,
m = names.length; j < m; j++) {
for (var j = 0, m = names.length; j < m; j++) {
params[names[j]] = captures[currentCapture++];
}

Expand Down Expand Up @@ -284,17 +283,15 @@ define(["exports", "./dsl"], function (exports, _dsl) {

var isEmpty = true;

for (var i = 0,
l = routes.length; i < l; i++) {
for (var i = 0, l = routes.length; i < l; i++) {
var route = routes[i],
names = [];

var segments = parse(route.path, names, types);

allSegments = allSegments.concat(segments);

for (var j = 0,
m = segments.length; j < m; j++) {
for (var j = 0, m = segments.length; j < m; j++) {
var segment = segments[j];

if (segment instanceof EpsilonSegment) {
Expand Down Expand Up @@ -338,8 +335,7 @@ define(["exports", "./dsl"], function (exports, _dsl) {
throw new Error("There is no route named " + name);
}

for (var i = 0,
l = route.handlers.length; i < l; i++) {
for (var i = 0, l = route.handlers.length; i < l; i++) {
result.push(route.handlers[i]);
}

Expand All @@ -359,8 +355,7 @@ define(["exports", "./dsl"], function (exports, _dsl) {

var segments = route.segments;

for (var i = 0,
l = segments.length; i < l; i++) {
for (var i = 0, l = segments.length; i < l; i++) {
var segment = segments[i];

if (segment instanceof EpsilonSegment) {
Expand Down Expand Up @@ -391,17 +386,15 @@ define(["exports", "./dsl"], function (exports, _dsl) {
}
}
keys.sort();
for (var i = 0,
len = keys.length; i < len; i++) {
for (var i = 0, len = keys.length; i < len; i++) {
key = keys[i];
var value = params[key];
if (value === null) {
continue;
}
var pair = encodeURIComponent(key);
if (isArray(value)) {
for (var j = 0,
l = value.length; j < l; j++) {
for (var j = 0, l = value.length; j < l; j++) {
var arrayPair = key + "[]" + "=" + encodeURIComponent(value[j]);
pairs.push(arrayPair);
}
Expand Down Expand Up @@ -449,7 +442,13 @@ define(["exports", "./dsl"], function (exports, _dsl) {
},

recognize: function (path) {
var states = [this.rootState], pathLen, i, l, queryStart, queryParams = {}, isSlashDropped = false;
var states = [this.rootState],
pathLen,
i,
l,
queryStart,
queryParams = {},
isSlashDropped = false;

queryStart = path.indexOf("?");
if (queryStart !== -1) {
Expand Down
3 changes: 1 addition & 2 deletions dist/commonjs/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ function generateMatch(startingPath, matcher, delegate) {

function addRoute(routeArray, path, handler) {
var len = 0;
for (var i = 0,
l = routeArray.length; i < l; i++) {
for (var i = 0, l = routeArray.length; i < l; i++) {
len += routeArray[i].path.length;
}

Expand Down
61 changes: 30 additions & 31 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function StaticSegment(string) {
}
StaticSegment.prototype = {
eachChar: function (callback) {
var string = this.string, ch;
var string = this.string,
ch;

for (var i = 0,
l = string.length; i < l; i++) {
for (var i = 0, l = string.length; i < l; i++) {
ch = string.charAt(i);
callback({ validChars: ch });
}
Expand Down Expand Up @@ -87,9 +87,9 @@ function parse(route, names, types) {
var segments = route.split("/"),
results = [];

for (var i = 0,
l = segments.length; i < l; i++) {
var segment = segments[i], match;
for (var i = 0, l = segments.length; i < l; i++) {
var segment = segments[i],
match;

if (match = segment.match(/^:([^\/]+)$/)) {
results.push(new DynamicSegment(match[1]));
Expand Down Expand Up @@ -119,8 +119,7 @@ State.prototype = {
get: function (charSpec) {
var nextStates = this.nextStates;

for (var i = 0,
l = nextStates.length; i < l; i++) {
for (var i = 0, l = nextStates.length; i < l; i++) {
var child = nextStates[i];

var isEqual = child.charSpec.validChars === charSpec.validChars;
Expand Down Expand Up @@ -150,12 +149,14 @@ State.prototype = {
return state;
},
match: function (ch) {
var nextStates = this.nextStates, child, charSpec, chars;
var nextStates = this.nextStates,
child,
charSpec,
chars;

var returned = [];

for (var i = 0,
l = nextStates.length; i < l; i++) {
for (var i = 0, l = nextStates.length; i < l; i++) {
child = nextStates[i];

charSpec = child.charSpec;
Expand Down Expand Up @@ -205,8 +206,7 @@ function sortSolutions(states) {
function recognizeChar(states, ch) {
var nextStates = [];

for (var i = 0,
l = states.length; i < l; i++) {
for (var i = 0, l = states.length; i < l; i++) {
var state = states[i];

nextStates = nextStates.concat(state.match(ch));
Expand All @@ -216,7 +216,8 @@ function recognizeChar(states, ch) {
}

var oCreate = Object.create || function (proto) {
function F() {}
var F = function () {};

F.prototype = proto;
return new F();
};
Expand All @@ -239,14 +240,12 @@ function findHandler(state, path, queryParams) {
currentCapture = 1;
var result = new RecognizeResults(queryParams);

for (var i = 0,
l = handlers.length; i < l; i++) {
for (var i = 0, l = handlers.length; i < l; i++) {
var handler = handlers[i],
names = handler.names,
params = {};

for (var j = 0,
m = names.length; j < m; j++) {
for (var j = 0, m = names.length; j < m; j++) {
params[names[j]] = captures[currentCapture++];
}

Expand Down Expand Up @@ -283,17 +282,15 @@ RouteRecognizer.prototype = {

var isEmpty = true;

for (var i = 0,
l = routes.length; i < l; i++) {
for (var i = 0, l = routes.length; i < l; i++) {
var route = routes[i],
names = [];

var segments = parse(route.path, names, types);

allSegments = allSegments.concat(segments);

for (var j = 0,
m = segments.length; j < m; j++) {
for (var j = 0, m = segments.length; j < m; j++) {
var segment = segments[j];

if (segment instanceof EpsilonSegment) {
Expand Down Expand Up @@ -337,8 +334,7 @@ RouteRecognizer.prototype = {
throw new Error("There is no route named " + name);
}

for (var i = 0,
l = route.handlers.length; i < l; i++) {
for (var i = 0, l = route.handlers.length; i < l; i++) {
result.push(route.handlers[i]);
}

Expand All @@ -358,8 +354,7 @@ RouteRecognizer.prototype = {

var segments = route.segments;

for (var i = 0,
l = segments.length; i < l; i++) {
for (var i = 0, l = segments.length; i < l; i++) {
var segment = segments[i];

if (segment instanceof EpsilonSegment) {
Expand Down Expand Up @@ -390,17 +385,15 @@ RouteRecognizer.prototype = {
}
}
keys.sort();
for (var i = 0,
len = keys.length; i < len; i++) {
for (var i = 0, len = keys.length; i < len; i++) {
key = keys[i];
var value = params[key];
if (value === null) {
continue;
}
var pair = encodeURIComponent(key);
if (isArray(value)) {
for (var j = 0,
l = value.length; j < l; j++) {
for (var j = 0, l = value.length; j < l; j++) {
var arrayPair = key + "[]" + "=" + encodeURIComponent(value[j]);
pairs.push(arrayPair);
}
Expand Down Expand Up @@ -448,7 +441,13 @@ RouteRecognizer.prototype = {
},

recognize: function (path) {
var states = [this.rootState], pathLen, i, l, queryStart, queryParams = {}, isSlashDropped = false;
var states = [this.rootState],
pathLen,
i,
l,
queryStart,
queryParams = {},
isSlashDropped = false;

queryStart = path.indexOf("?");
if (queryStart !== -1) {
Expand Down
3 changes: 1 addition & 2 deletions dist/system/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ System.register([], function (_export) {

function addRoute(routeArray, path, handler) {
var len = 0;
for (var i = 0,
l = routeArray.length; i < l; i++) {
for (var i = 0, l = routeArray.length; i < l; i++) {
len += routeArray[i].path.length;
}

Expand Down
Loading

0 comments on commit 446895b

Please sign in to comment.