简化语法

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 // string 转 binary
export function str2bin(str) { export function str2bin(str) {
let bin = ''
let u8 = encode(str) // 转成Uint8Array let u8 = encode(str) // 转成Uint8Array
for (let i = 0; i < u8.length; i++) { return String.fromCharCode.apply(null, u8)
bin += String.fromCharCode(u8[i])
}
return bin
} }
export function bin2str(b) { export function bin2str(b) {