From 2f77345d24a3b7e73591a82c1b9540022b790ca9 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Tue, 9 Oct 2018 01:41:05 +0000 Subject: [PATCH] Simplified a bit of JavaScript and TypeScript code. --- javascript/qrcodegen.js | 2 +- typescript/qrcodegen.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 1834294..520daad 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -513,7 +513,7 @@ var qrcodegen = new function() { var step = (version == 32) ? 26 : Math.ceil((size - 13) / (numAlign*2 - 2)) * 2; var result = [6]; - for (var i = 0, pos = size - 7; i < numAlign - 1; i++, pos -= step) + for (var pos = size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos); return result; } diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 1fbfa45..e2c1964 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -598,7 +598,7 @@ namespace qrcodegen { let step: int = (this.version == 32) ? 26 : Math.ceil((this.size - 13) / (numAlign*2 - 2)) * 2; let result: Array = [6]; - for (let i = 0, pos = this.size - 7; i < numAlign - 1; i++, pos -= step) + for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos); return result; }