简化语法

master
yutent 2024-06-26 13:51:01 +08:00
parent bde1557408
commit 45a7e8b2be
1 changed files with 1 additions and 5 deletions

View File

@ -2,12 +2,8 @@ import { encode, decode } from './helper.js'
// string 转 binary
export function str2bin(str) {
let bin = ''
let u8 = encode(str) // 转成Uint8Array
for (let i = 0; i < u8.length; i++) {
bin += String.fromCharCode(u8[i])
}
return bin
return String.fromCharCode.apply(null, u8)
}
export function bin2str(b) {