charset-pl
Version:
polish charset? idk
10 lines (8 loc) • 409 B
text/typescript
import m from './tools/chars'
import toBinary from './tools/toBinary'
import split from './tools/split'
export = function (s: string | Buffer): string {
if (!s) return ''
var hexarray = s instanceof Buffer ? split(s.toString('hex'), 2) : (s.includes(' ') ? s.split(' ') : split(s, 2))
return split(hexarray.map(hex => toBinary(parseInt(hex, 16), 8)).join(''), 6).map(s => m[parseInt(s, 2)]).join('')
}