charset-pl
Version:
polish charset? idk
13 lines (11 loc) • 385 B
text/typescript
import m from './tools/chars'
import toBinary from './tools/toBinary'
import split from './tools/split'
export = function(s: string): Buffer {
if (!s) return Buffer.from('')
var binary = ''
s.toLowerCase().split('').forEach(char => {
binary += m.indexOf(char) !== -1 ? toBinary(m.indexOf(char), 6) : ''
})
return Buffer.from(split(binary, 8).map(x => parseInt(x, 2)))
}