Browse Source

Merge pull request #25 from fanatid/fix/code-style

fix code style
master
Feross Aboukhadijeh 9 years ago
parent
commit
788522f2dd
  1. 13
      lib/b64.js

13
lib/b64.js

@ -8,17 +8,12 @@ var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
function init () {
var i
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var len = code.length
for (i = 0; i < len; i++) {
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i]
}
for (i = 0; i < len; ++i) {
revLookup[code.charCodeAt(i)] = i
}
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63
}
@ -50,8 +45,8 @@ function toByteArray (b64) {
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
arr[L++] = (tmp & 0xFF0000) >> 16
arr[L++] = (tmp & 0xFF00) >> 8
arr[L++] = (tmp >> 16) & 0xFF
arr[L++] = (tmp >> 8) & 0xFF
arr[L++] = tmp & 0xFF
}

Loading…
Cancel
Save