Skip to content

Commit b21ee6f

Browse files
committed
Avoid big int literals
1 parent 71a356b commit b21ee6f

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/utils/chat.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function vt(fid: bigint | number, payload: bigint | number): Uint8Array {
8080
}
8181

8282
function pbh(fid: bigint | number, type: number): bigint {
83-
return encv((BigInt(fid) << 3n) | BigInt(type));
83+
return encv((BigInt(fid) << BigInt(3)) | BigInt(type));
8484
}
8585

8686
function bitou8(n: bigint | number): Uint8Array {
@@ -115,12 +115,12 @@ function concatu8(args: Uint8Array[]): Uint8Array {
115115
return out;
116116
}
117117
function encv(n: bigint): bigint {
118-
let s = 0n;
119-
while (n >> 7n) {
120-
s = (s << 8n) | 0x80n | (n & 0x7fn);
121-
n >>= 7n;
118+
let s = BigInt(0);
119+
while (n >> BigInt(7)) {
120+
s = (s << BigInt(8)) | BigInt(0x80) | (n & BigInt(0x7f));
121+
n >>= BigInt(7);
122122
}
123-
s = (s << 8n) | n;
123+
s = (s << BigInt(8)) | n;
124124
return s;
125125
}
126126

vite.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ export default ({ mode }) => {
158158
},
159159
sourcemap: true,
160160
build: {
161-
target: "esnext", // you can also use 'es2020' here
162161
rollupOptions: {
163162
input: {
164163
main: path.resolve(__dirname, "index.html"),
@@ -186,11 +185,6 @@ export default ({ mode }) => {
186185
},
187186
},
188187
},
189-
optimizeDeps: {
190-
esbuildOptions: {
191-
target: "esnext", // you can also use 'es2020' here
192-
},
193-
},
194188
server: {
195189
port: 8080,
196190
proxy: {

0 commit comments

Comments
 (0)