Skip to content

Commit

Permalink
use slice instead of substring
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Apr 11, 2015
1 parent 0bcd94f commit 6831782
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ var Router = (function () {
var e = undefined;

if (l === pl) {
search = search.substring(l);
search = search.slice(l);
}

// Search SNODE
Expand All @@ -341,12 +341,12 @@ var Router = (function () {
for (var i = 0; i < l && search.charCodeAt(i) !== 47 /*'/'*/; i++) {}

params[n] = {
name: e.prefix.substring(1),
value: search.substring(0, i)
name: e.prefix.slice(1),
value: search.slice(0, i)
};
n++;

search = search.substring(i);
search = search.slice(i);
continue;
} else {
// Search CNODE
Expand Down
8 changes: 4 additions & 4 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class Router {
let e;

if (l === pl) {
search = search.substring(l);
search = search.slice(l);
}

// Search SNODE
Expand All @@ -324,12 +324,12 @@ class Router {
for (var i = 0; i < l && (search.charCodeAt(i) !== 0x2F /*'/'*/); i++) {}

params[n] = {
name: e.prefix.substring(1),
value: search.substring(0, i)
name: e.prefix.slice(1),
value: search.slice(0, i)
};
n++;

search = search.substring(i)
search = search.slice(i);
continue;
} else {
// Search CNODE
Expand Down

0 comments on commit 6831782

Please sign in to comment.