Skip to content

Commit a6aa332

Browse files
authored
Merge pull request #18 from journey-ad/patch-1
Avoid uninitialized let in nested for-loop headers for ES5 compat
2 parents 8355089 + 6aaa9a3 commit a6aa332

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

docs/integrity.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
index.mjs: sha384-m4b9mo8rku6/YQbV1e52UTglSzniaJVeyuq4NnpxRZtq9UrxWXKj+/Mx9MvtPRhK
2-
index.js: sha384-jh47I3nzhofHfyfvgZFdmqUk4CYrsTIaq9LwhVmsWOFiX88x2h46P06/aDeaEtXp
3-
nano.mjs: sha384-avNlMHLjqxeTtXysYm13MNj05YYIEl5Fg3itpc7p/JdjS3ULukmDYKaqUMtBj6tT
1+
index.mjs: sha384-ix/UIenTZ8IyJxa+sJjONUP54ZVdea4Lx1HLnQ6H19foghKqyGi2tWwKqEBZ/fMP
2+
index.js: sha384-rMLAHwGIF45U925zCR19N4xrcJ0oWFePEJ1n97/WvrJF+ON9OcD7oky9FnZJjeaj
3+
nano.mjs: sha384-XThBBrKCQC9Alnv0+HEu/eQjYCSDEkmYTNMzQyLrfFpf4HDpj/Mhti8J8kTD0liW
44
extras/svg.mjs: sha384-Gk8g8nmt6RvyscmK2SxGhYHjrlr8PGRa9CD96IKO9EfLBGE1Wpj/pT8TgbuUXYXM
55
extras/svg.js: sha384-VYnYxwUAQvjDtTiso2ihlfJcfZY60ZgYYdd5YKEO1B4BtZ3P7fxQ5WNuPPG/i8Np
66
extras/node_export.mjs: sha384-jY8CQmq1wxq5w4nuvoBv5cQ+YlO4CAy1qLQ1ZzisUY+YKNSk0IiiQBG6xzZ4t7il
@@ -11,4 +11,4 @@ extras/vue.mjs: sha384-Q4U/qU20x7la3XGJDH1okfzFYN5r+AahC/KAu3xJi5vmOj0GP
1111
extras/vue.js: sha384-lkJRxa/w/MmxmQCuZWCv3qKGlSyuRD86eaGUWktxjO/n7pcUstsLUW2COHlYDYQ4
1212
extras/errors.mjs: sha384-LaUpr3MpI+ZWjDG8L54lwBzgymdm+C1fijP3Z3HukZOFOn3nmRUtgK5aTmOSVm/q
1313
extras/errors.js: sha384-lpwl8zlB1GwhvS1ftgUv4mCvOhlixuRa8fRag2aZ2PEEPKQ++l+IjhZL8lhbZMVe
14-
webcomponent.mjs: sha384-9dDat7/8CJ6E17L+k4st+cuCTZKpoAQ8TnkM+IqePpen71TrCZHaqfWzeD+qXg48
14+
webcomponent.mjs: sha384-QTlW/1U8Fi4zgSsbEx+i8+CHNfzzIWxgw8hH0hc4qwVBJN5omqCsXJ6a7d8aDzKd

docs/stats.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
index.mjs: 6898 bytes / 3670 bytes (compressed)
2-
index.js: 6914 bytes / 3661 bytes (compressed)
3-
nano.mjs: 3763 bytes / 2159 bytes (compressed)
1+
index.mjs: 6897 bytes / 3667 bytes (compressed)
2+
index.js: 6913 bytes / 3661 bytes (compressed)
3+
nano.mjs: 3762 bytes / 2160 bytes (compressed)
44
extras/svg.mjs: 1333 bytes / 945 bytes (compressed)
55
extras/svg.js: 1350 bytes / 942 bytes (compressed)
66
extras/node_export.mjs: 1069 bytes / 785 bytes (compressed)
@@ -11,4 +11,4 @@ extras/vue.mjs: 1059 bytes / 686 bytes (compressed)
1111
extras/vue.js: 1066 bytes / 684 bytes (compressed)
1212
extras/errors.mjs: 287 bytes / 342 bytes (compressed)
1313
extras/errors.js: 287 bytes / 340 bytes (compressed)
14-
webcomponent.mjs: 8634 bytes / 4442 bytes (compressed)
14+
webcomponent.mjs: 8633 bytes / 4443 bytes (compressed)

src/qr/errorCorrection.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const calculateEC = (versionBytes, correction) => {
2323
const result = makeUint8Array(size);
2424
size = 0;
2525
for (const bs of blocks) {
26-
for (let i = 0, prev; size !== prev; ++i) {
26+
for (let i = 0, prev = -1; prev < size; ++i) {
2727
prev = size;
2828
for (const block of bs) {
2929
if (i < block.length) {

src/qr/score.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const matches = 0b00000000001_00000000001;
55
export const scoreCode = ({ size, _data }, score = 0, totalOn = 0) => {
66
for (let i = 0; i < size; ++i) {
77
for (let n = 0; n < 2; ++n) {
8-
for (let j = 0, state = 0, consec = 0, last; j < size; ++j) {
8+
for (let j = 0, state = 0, consec, last = 2; j < size; ++j) {
99
const cur = _data[n ? i * size + j : j * size + i] & 1;
1010
totalOn += cur;
1111
state = ((state >> 1) | initial) & (pattern ^ (cur - 1));
1212
if (state & matches) {
1313
score += 40;
1414
}
15-
if (cur !== last) {
15+
if (cur ^ last) {
1616
consec = 0;
1717
}
1818
last = cur;

0 commit comments

Comments
 (0)