servez 1.13.2 → 1.13.5

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.
Files changed (2) hide show
  1. package/bin/servez +5 -27
  2. package/package.json +2 -2
package/bin/servez CHANGED
@@ -20,41 +20,19 @@ const log = {
20
20
  };
21
21
 
22
22
  function genQRCode(s) {
23
- const blockChars = [
24
- ' ', // 0
25
- '▘', // 1
26
- '▝', // 2
27
- '▀', // 3
28
- '▖', // 4
29
- '▌', // 5
30
- '▞', // 6
31
- '▛', // 7
32
- '▗', // 8
33
- '▚', // 9
34
- '▐', // 10
35
- '▜', // 11
36
- '▄', // 12
37
- '▙', // 13
38
- '▟', // 14
39
- '█', // 15
40
- ];
41
23
 
42
24
  const qr = QrCode.encodeText(s, Ecc.MEDIUM);
43
- const size = ((qr.size + 1) / 2 | 0) * 2 + 2;
25
+ const size = qr.size + 2;
44
26
 
45
27
  const lines = [];
46
- for (let y = -2; y < size; y += 2) {
28
+ for (let y = -2; y < size; ++y) {
47
29
  const line = [];
48
- for (let x = -2; x < size; x += 1) {
49
- const code = (qr.getModule(x + 0, y + 0) ? 1 : 0) |
50
- (qr.getModule(x + 0, y + 0) ? 2 : 0) |
51
- (qr.getModule(x + 0, y + 1) ? 4 : 0) |
52
- (qr.getModule(x + 0, y + 1) ? 8 : 0) ;
53
- line.push(blockChars[code]);
30
+ for (let x = -2; x < size; ++x) {
31
+ line.push(c[qr.getModule(x, y) ? 'bgBlack' : 'bgWhite'](' '));
54
32
  }
55
33
  lines.push(line.join(''));
56
34
  }
57
- return c.bgWhite(c.black(lines.join('\n')));
35
+ return lines.join('\n');
58
36
  }
59
37
 
60
38
  const optionSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "servez",
3
- "version": "1.13.2",
3
+ "version": "1.13.5",
4
4
  "description": "A simple command line server to replace http-server",
5
5
  "scripts": {
6
6
  "start": "node ./bin/servez"
@@ -26,7 +26,7 @@
26
26
  "ansi-colors": "^4.1.1",
27
27
  "color-support": "^1.1.3",
28
28
  "optionator": "^0.8.2",
29
- "servez-lib": "^2.5.0"
29
+ "servez-lib": "^2.5.2"
30
30
  },
31
31
  "bin": {
32
32
  "servez": "./bin/servez"