Browse Source

Remove argument from charCodeAt

Resolves #2
master
Luke Childs 7 years ago
parent
commit
621460517b
  1. 2
      b64golf.js

2
b64golf.js

@ -5,7 +5,7 @@ const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
const b64Encode = str => [...str]
// Map character bytes to 8-bit binary values
// Mapping to unescape(encodeURIComponent(c)) first is necessary to handle multibyte characters
.map(c => [...unescape(encodeURIComponent(c))].map(c => c.charCodeAt(0).toString(2).padStart(8, 0)).join(''))
.map(c => [...unescape(encodeURIComponent(c))].map(c => c.charCodeAt().toString(2).padStart(8, 0)).join(''))
// Join 8-bit binary values to produce binary string
.join('')
// Split binary string out into 6-bit values

Loading…
Cancel
Save