qr-min 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -143,6 +143,17 @@
143
143
  }
144
144
  }
145
145
  d[sz - 8][8] = 1;
146
+ if (v > 6) {
147
+ m = v;
148
+ for (k = 0; k < 12; k++) m = (m << 1) ^ ((m >>> 11) * 0x1F25);
149
+ m = v << 12 | m;
150
+ for (k = 0; k < 18; k++) {
151
+ i = sz - 11 + k % 3;
152
+ j = Math.floor(k / 3);
153
+ d[i][j] = (m & (1 << k)) >>> k;
154
+ d[j][i] = (m & (1 << k)) >>> k;
155
+ }
156
+ }
146
157
  }
147
158
  function _res(v) {
148
159
  var i, j, k, m, sz = v * 4 + 17, e = _eyes(v);
@@ -168,6 +179,10 @@
168
179
  r[e[k] + i - 2][e[m] + j - 2] = 1;
169
180
  }
170
181
  }
182
+ if (v > 6) for (i = 0; i < 6; i++) for (j = 0; j < 3; j++) {
183
+ r[i][sz - j - 9] = 1;
184
+ r[sz - j - 9][i] = 1;
185
+ }
171
186
  return r;
172
187
  }
173
188
  function _format(d, c, m) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qr-min",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Minimal implementation to generate a QR code from a UTF-8 string",
5
5
  "main": "javascript/qr-min.js",
6
6
  "scripts": {
package/test/mocha.js CHANGED
@@ -43,6 +43,40 @@ describe('qr', function() {
43
43
  █ ███ █ ▀▀█▄█▄ ▄▀▀ █▀▀██ ▄▄█
44
44
  █ ▀▀▀ █ █▄ ▀█▄█▄ █▄█▄▄ ▀█▀ ▄▀
45
45
  ▀▀▀▀▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀ ▀▀ ▀▀
46
+ `.substring(1));
47
+ }); it('long', function() {
48
+ assert.equal(text(QR('😀😃😄😁😆😅😂🤣😊😇🙂🙃😉😌😍🥰😘😗😙😚😋😛😝😜🤪🤨🧐🤓😎🤩🥳😏😒😞😀😃😄😁😆😅😂🤣😊😇🙂🙃😉😌😍🥰😘😗😙😚😋😛😝😜🤪🤨🧐🤓😎🤩🥳😏😒😞')),`
49
+ █▀▀▀▀▀█ ▄▄▄▀█ ▀ █▄ ▀█▄█ █▄▀▄██▀▄▄█▄ ▄█ ▄▀▀▄ ▄ ██ █▀▀▀▀▀█
50
+ █ ███ █ ▀██ ██▄▄█ █ ██▀▄▄██ ▄▀█▄█▄█▄ █▀▄▀▄▄▀████▀█ █ ███ █
51
+ █ ▀▀▀ █ ▀██ ██▄ ▀▄ ▄█ ▀▄█▀ █▀▀▀██ ▀▀▀▄ ▄ ▄▀ ▀▄██▀ █ ▀▀▀ █
52
+ ▀▀▀▀▀▀▀ █▄▀ █▄▀ ▀▄█ █ █▄█ ▀▄█ ▀ █▄█ ▀▄▀ █▄▀▄▀ █ ▀▄▀ ▀ ▀▀▀▀▀▀▀
53
+ ▀▀█▄▀█▀▀█▄▄█▀▄ ███ █▀▀▄▄█ ▀▄████▀██ ▄▄█▀ ▄▄ █▄▄ ▄█████▄ █
54
+ ▄ ▀█▀ ▀█▄▄███▄ ▀▄▄ █▀▄▀▄██ █▄██▄▄▀▀ █▀█ █ ██ █▀█▀▄▄█ █▄▄
55
+ █▀█ █▀▀█ ▄█▄▄▀▄██ ██ ▄▄▀▄ ▄█▀▀ ▀▄ ▀█▀▄ ▄█▄ ▄██▄█▄██▀▄▄ ██ ▀
56
+ ▄█▄▄▀█▀▀█▄█▀▄█▄▄▀ ▀▄█ ▀▀▄▄▀▀▄█▀ ▄█ ▀██ ▀█ █▄▀▄ ██▄▀█ █▄█ ▄
57
+ ▄ ▀▀▀▄▀▀ █ ▀██ █▀▄██ ▀█▀ ▄▄▀█▀ ▄█▄ ▄ ▄█▄▀ ▄█▄ ▄█▀▄▄█▀▄▄▀▀▀
58
+ ▀▀▀▄ ▀▀▄ ▀▄▄▀▄ ▄▄▀▀▄▄▀█▀▀▄███▄▄ █▀▄▄█ ▀ ██ ▀█ ▄█ ▀▀█ ▀ █ ▄
59
+ ▀█▄ ██▀▀ ▄ ▀▄█▀▄▄ ██▀▄██ ▄███ ██▀ ▄▄█ ▀▄█ ▄█▄▄ ▀█▄▄█▄▄ ▀▄▀
60
+ ███▄▄█▀▄█▄█▀▀▄█▀▄ ▀▄▀▄▀▄██▄██▄█▀▄█▀▀ ▀█▄▀█▀▀▀▄▄ █▀▄▀▄█▀ █▄▄
61
+ ▄▀█▀█▀▀█▄ ▀▄ ▀██ ▀ █ ███ ▀▄██ ▀ ▄▄ █▄▄ ▄█ ▄███▄█▄██▀▄ ▄██ █
62
+ ▀█▄▀██▀▀█▀▀▀▀ ▀▄▀▀█ ▄▀▄▀▄▄▀█▀▀█ ▀█ ▄▀ ▄ ▀█▀▄ █▄███▄▀█ ▀▄▄██
63
+ █▀▀ █▀▀▀█▀ █▀█ ▀▄▀▄██ ██ ██▀▀▀█▄██▄ ▄ ▄█▄█▄▀▄▄ ▄█▀█▀▀▀█▄▀▄█
64
+ ▀█▄▀█ ▀ █▀▀▄▀▀▀██▄▀▀▄█▄▄▀▀▄▄█ ▀ █▀█▀ ▄▀▀ ▄▄▄▀▀▄▀▀▀▀▀█ ▀ █ ▄ ▄
65
+ ▄██▀█▀▀▀████▄▀██▀ ███ █ █▀▀██▀█▄ ▄▄█▄ ▄█▄ █▄ ▄▀▄███▀▀██ ▀
66
+ ▄█ ██▀▀▄ █ ▀██▀▀▄▄▀▄▀ ▄▄ █▀█▄██▀█▀ ▀█▄▀ █▄▄▀▀▀▄█ █▀ █ ▄█▄
67
+ ▀▀▄▀█▀▀█▀ ████▄▄▀▄ ██▄ █ █ ▄▀ ▄▄ █▄█▄▄ ▄▄█▀▄▄██▀▀▄▄▄██ █
68
+ ▄▀█▀▀ ██▄▀ ▀█▄▀█▄▄█▀▄▀▄ ▀▀▄▄ ▀▄▄▀ █ ▀ █▀ ▄ ▄▀███ ▀▄██▄
69
+ ▄▀ █▄ ▀█ ▄▄ ▀▀▄▀▄█ █▀ ██ ▀█ ▄ ▀▄▄█▀▄██ ▄█▄▄ ▀▄ ▄██▀▄ ██▄█
70
+ ▄ ▀█▀▄▀▀ ▄█▀▀ ▄▀█▀▄ ▄▀▀▄█▀▄█▄█▀█▀▀█ ▀ ▀█ ▄▄ █ ▄▄ ▀▄▀▄ ▀
71
+ ▀▄▀▀▄▀▀█ ▄█▀ ███ ██ ▀▄ ▄█▀▄███▄ ▀█▀▄ ▄█▄ ▄█ ▄ █▀▀▄▀███ ▀
72
+ ▄ ▀ ▀ █ ▄█▄▀ ▄█▀▄▄▀ ▀▀█▄ ▀█▄▀ ███ ▀▀█ █▀█ ██▀ █ █ ▄▀▄█▄
73
+ █▄█ ▄ ▀ ▄▄▄██ █ █ ▀▄ ▀█▀▄ █ ▄▄█▄ █▄▀▄ █ ▄▄█▄ ▄██▀▀▄██▀█ █
74
+ ▄▄█▀█▀▀█▄ █▀▀▀▄ ▄█▀ ▀▀▄█▀ ▄▀▄ ▀▀▄█▀ █▀▀ ▀▀▄▀ ▄█ █▀██ ▀█▄▀
75
+ ▀▀▀▀ ▀ ▄█▄▄█▄▀▀▄▄▄██ ██▀▄▀█▀▀▀██▀▀ ▄█ ▀ ▄▄ █ █▄▀█▀▀▀█▄ ▀▀
76
+ █▀▀▀▀▀█ █▄▀▀▄▄▄▄▄ ▀▄█▄ ▄▀█▄▄█ ▀ █▀█▄ ▄ ▀ ▀ ██ ▀▀▄ ▀█ ▀ █ █▄
77
+ █ ███ █ ▀█▄▀ ▀▄█ ▀ █▄ ▀▄█ █▀█▀▀██▄▄ █▄ ▄█▀ ▄█ ▄▀█▀██████ ▄
78
+ █ ▀▀▀ █ ██▄▄▀ ▀▄█▀▄ ▄▀ ▄▀▄ ████▀██▄ ▀▄ █▄ ▀▀▀█▀ █ █▄▄█ ▄▄█▄▀
79
+ ▀▀▀▀▀▀▀ ▀ ▀▀▀ ▀ ▀ ▀ ▀ ▀▀ ▀▀ ▀ ▀ ▀ ▀▀ ▀▀ ▀▀▀▀
46
80
  `.substring(1));
47
81
  });
48
82
  });