简化语法
parent
bde1557408
commit
45a7e8b2be
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue