Skip to content

Commit bce9869

Browse files
committed
chore: run prettier
1 parent 2a02c2d commit bce9869

File tree

7 files changed

+235
-202
lines changed

7 files changed

+235
-202
lines changed

.github/dependabot.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ updates:
1212
schedule:
1313
interval: weekly
1414
day: thursday
15-
time: "07:00"
16-
timezone: "Asia/Baghdad"
15+
time: '07:00'
16+
timezone: 'Asia/Baghdad'
1717
groups:
1818
dependencies:
1919
patterns:
20-
- "*"
20+
- '*'

.github/workflows/docs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: GitHub pages
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: ['main']
66
workflow_dispatch:
77

88
permissions:
@@ -11,7 +11,7 @@ permissions:
1111
id-token: write
1212

1313
concurrency:
14-
group: "pages"
14+
group: 'pages'
1515
cancel-in-progress: true
1616

1717
jobs:
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install Node
2727
uses: actions/setup-node@v1
2828
with:
29-
node-version: "18.x"
29+
node-version: '18.x'
3030
- name: install deps
3131
run: npm ci
3232
- name: Build Docs

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
on: [push]
33
concurrency:
4-
group: "CI"
4+
group: 'CI'
55
cancel-in-progress: true
66

77
jobs:
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node: ["16.x", "18.x", "20.x"]
14+
node: ['16.x', '18.x', '20.x']
1515

1616
steps:
1717
- name: Checkout repo

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
workflow_dispatch:
1010

1111
concurrency:
12-
group: "Release"
12+
group: 'Release'
1313
cancel-in-progress: true
1414

1515
jobs:

README.md

+178-143
Large diffs are not rendered by default.

src/QRCodeRaw.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default class QRCodeRaw {
6969
const padding = this.padding;
7070
const invert = this.invert;
7171
const rowPadding = Array<boolean>(padding * 2 + modules.length).fill(
72-
invert
72+
invert,
7373
);
7474
const rowsPadding = Array<boolean[]>(padding).fill(rowPadding);
7575
const columnPadding = Array<boolean>(padding).fill(invert);
@@ -81,8 +81,8 @@ export default class QRCodeRaw {
8181
const qrCodeRow: boolean[] = [];
8282
qrCodeRow.push(
8383
...columnPadding,
84-
...row.map(isBlack => (invert ? !isBlack : isBlack)),
85-
...columnPadding
84+
...row.map((isBlack) => (invert ? !isBlack : isBlack)),
85+
...columnPadding,
8686
);
8787
qrCodeData.push(qrCodeRow);
8888
});
@@ -98,7 +98,7 @@ export default class QRCodeRaw {
9898
try {
9999
const qrcode = new QRCodeCore(
100100
this.typeNumber,
101-
ErrorCorrectLevel[this.level]
101+
ErrorCorrectLevel[this.level],
102102
);
103103
qrcode.addData(this.value);
104104
qrcode.make();

src/QRCodeText.ts

+44-46
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,60 @@ import QRCodeRaw from './QRCodeRaw';
22
import type { OptionsType as ParentOptionsType } from './QRCodeRaw';
33

44
export type OptionsType = ParentOptionsType & {
5-
blackSymbol: string,
6-
whiteSymbol: string,
7-
}
5+
blackSymbol: string;
6+
whiteSymbol: string;
7+
};
88

99
const DEFAULT_OPTIONS = {
10-
blackSymbol: '▓▓',
11-
whiteSymbol: ' ',
10+
blackSymbol: '▓▓',
11+
whiteSymbol: ' ',
1212
};
1313

1414
export default class QRCodeText extends QRCodeRaw {
15+
blackSymbol: string;
16+
whiteSymbol: string;
17+
qrCodeText: string | undefined | null;
18+
19+
constructor(value: string, options: Partial<OptionsType> = {}) {
20+
super(value, options);
21+
const params = { ...DEFAULT_OPTIONS, ...options };
22+
23+
this.blackSymbol = params.blackSymbol;
24+
this.whiteSymbol = params.whiteSymbol;
25+
}
26+
27+
_clearCache(): void {
28+
super._clearCache();
29+
this.qrCodeText = null;
30+
}
31+
32+
toString(): null | string {
33+
if (this.qrCodeText) {
34+
return this.qrCodeText;
35+
}
1536

16-
blackSymbol: string;
17-
whiteSymbol: string;
18-
qrCodeText: string | undefined| null;
37+
const dataSize = this.getDataSize();
38+
if (!dataSize) {
39+
return null;
40+
}
1941

20-
constructor(value: string, options: Partial<OptionsType> = {}) {
21-
super(value, options);
22-
const params = { ...DEFAULT_OPTIONS, ...options };
42+
const data = this.getData();
2343

24-
this.blackSymbol = params.blackSymbol;
25-
this.whiteSymbol = params.whiteSymbol;
44+
// FIXME eh?
45+
if (data === null) {
46+
return null;
2647
}
2748

28-
_clearCache(): void {
29-
super._clearCache();
30-
this.qrCodeText = null;
31-
}
49+
const symbols: string[] = [];
3250

33-
toString(): null | string {
34-
if (this.qrCodeText) {
35-
return this.qrCodeText;
36-
}
37-
38-
const dataSize = this.getDataSize();
39-
if (!dataSize) {
40-
return null;
41-
}
42-
43-
const data = this.getData();
44-
45-
// FIXME eh?
46-
if (data === null) {
47-
return null;
48-
}
49-
50-
const symbols:string[] = [];
51-
52-
for (let y = 0; y < dataSize; y += 1) {
53-
for (let x = 0; x < dataSize; x += 1) {
54-
const isBlack = data[y][x];
55-
symbols.push(isBlack ? this.blackSymbol : this.whiteSymbol);
56-
}
57-
symbols.push('\n');
58-
}
59-
this.qrCodeText = symbols.join('');
60-
return this.qrCodeText;
51+
for (let y = 0; y < dataSize; y += 1) {
52+
for (let x = 0; x < dataSize; x += 1) {
53+
const isBlack = data[y][x];
54+
symbols.push(isBlack ? this.blackSymbol : this.whiteSymbol);
55+
}
56+
symbols.push('\n');
6157
}
62-
58+
this.qrCodeText = symbols.join('');
59+
return this.qrCodeText;
60+
}
6361
}

0 commit comments

Comments
 (0)