Skip to content

Instantly share code, notes, and snippets.

@quentint
Created September 18, 2023 08:38
Show Gist options
  • Save quentint/129b9811c3fb99278a89597312453766 to your computer and use it in GitHub Desktop.
Save quentint/129b9811c3fb99278a89597312453766 to your computer and use it in GitHub Desktop.
function bitsToCharacter(bits: string): string {
console.assert(bits.match(/^[01]{6}$/) !== null, 'Bits must only contain 6 0 and 1 characters (width is 2 and height is 3)')
return String.fromCharCode(parseInt(bits.split('').reverse().join(''), 2) + 32)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment