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