Last active
September 18, 2017 22:34
-
-
Save patrickroberts/51244bc23c77ccf3cb5ebddd23d197b1 to your computer and use it in GitHub Desktop.
standard test fail (possible bug)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function characterRange (minCharacter, maxCharacter) { | |
const lower = minCharacter.charCodeAt(0) | |
const upper = maxCharacter.charCodeAt(0) | |
return Array(upper - lower + 1) | |
.fill() | |
.map((_, index) => String.fromCharCode(lower + index)) | |
.join('') | |
} | |
const base64 = | |
characterRange('A', 'Z') + | |
characterRange('a', 'z') + | |
characterRange('0', '9') + | |
'+/' | |
const unbase64 = Array.from(base64) | |
.reduce((table, character, index) => { | |
table[character.charCodeAt(0)] = index | |
return table | |
}), { ['='.charCodeAt(0)]: 64 }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment