From 4af085d9d87d7b7f3516bcacea473532cb126caf Mon Sep 17 00:00:00 2001 From: pwkad Date: Wed, 2 Mar 2016 11:25:15 -0600 Subject: [PATCH] chore(for-of): fix segments.js remove for of --- src/route-recognizer.js | 2 +- src/segments.js | 3 ++- test/route-recognizer.spec.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/route-recognizer.js b/src/route-recognizer.js index 34d5311..bae8e45 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 (var i = 0; i < splitRoute.length; i++) { + for (let i = 0; i < splitRoute.length; i++) { let segment = splitRoute[i]; let match = segment.match(/^:([^\/]+)$/); if (match) { diff --git a/src/segments.js b/src/segments.js index 34eabef..03b83b4 100644 --- a/src/segments.js +++ b/src/segments.js @@ -28,7 +28,8 @@ export class StaticSegment { } eachChar(callback: (spec: CharSpec) => void): void { - for (let ch of this.string) { + for (let i = 0; i < this.string.length; i++) { + let ch = this.string[i]; callback({ validChars: ch }); } } diff --git a/test/route-recognizer.spec.js b/test/route-recognizer.spec.js index 7de60d5..0e9f628 100644 --- a/test/route-recognizer.spec.js +++ b/test/route-recognizer.spec.js @@ -67,8 +67,8 @@ describe('route recognizer', () => { expect(recognizer.recognize('/b')).toBeTruthy(); }); - for (var i = routeTestData.length - 1; i >= 0; i--) { - var routeTest = routeTestData[i] + for (let i = routeTestData.length - 1; i >= 0; i--) { + let routeTest = routeTestData[i]; it(`should recognize ${routeTest.title}`, () => { let recognizer = new RouteRecognizer();