diff --git a/src/route-recognizer.js b/src/route-recognizer.js index bae8e45..3a9fab9 100644 --- a/src/route-recognizer.js +++ b/src/route-recognizer.js @@ -238,7 +238,7 @@ function parse(route, names, types) { let results = []; let splitRoute = normalizedRoute.split('/'); - for (let i = 0; i < splitRoute.length; i++) { + for (let i = 0, ii = splitRoute.length; i < ii; ++i) { let segment = splitRoute[i]; let match = segment.match(/^:([^\/]+)$/); if (match) { diff --git a/src/segments.js b/src/segments.js index 03b83b4..1ff7281 100644 --- a/src/segments.js +++ b/src/segments.js @@ -28,8 +28,9 @@ export class StaticSegment { } eachChar(callback: (spec: CharSpec) => void): void { - for (let i = 0; i < this.string.length; i++) { - let ch = this.string[i]; + let s = this.string; + for (let i = 0, ii = s.length; i < ii; ++i) { + let ch = s[i]; callback({ validChars: ch }); } }