/**
* formats binary with spaces @ every 10 spaces
*/
function fromBinaryToPrettyBinary(binary: number | string): string {
let index = -1
const msgs = ['', '']
return (binary as string)
.split('')
.map(char => {
index += 1
if (index % 8 === 0) {
msgs[0] += '10'
msgs[1] += '| '
return ' | ' + char
} else if (index % 2 === 0) {
msgs[0] += ' '
msgs[1] += ' '
return ',' + char
} else {
msgs[0] += ' '
msgs[1] += ' '
return '' + char
}
})
.join('')
.replace(' | ', '')
}
export { fromBinaryToPrettyBinary }
export default fromBinaryToPrettyBinary