Browse Source

make internal/external naming consistent

master
Feross Aboukhadijeh 9 years ago
parent
commit
4b1309ee6f
  1. 10
      lib/b64.js

10
lib/b64.js

@ -1,5 +1,8 @@
'use strict' 'use strict'
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
var i var i
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var lookup = [] var lookup = []
@ -23,7 +26,7 @@ function decode (elt) {
return v !== undefined ? v : -1 return v !== undefined ? v : -1
} }
function b64ToByteArray (b64) { function toByteArray (b64) {
var i, j, l, tmp, placeHolders, arr var i, j, l, tmp, placeHolders, arr
if (b64.length % 4 > 0) { if (b64.length % 4 > 0) {
@ -87,7 +90,7 @@ function encodeChunk (uint8, start, end) {
return output.join('') return output.join('')
} }
function uint8ToBase64 (uint8) { function fromByteArray (uint8) {
var i var i
var extraBytes = uint8.length % 3 // if we have 1 byte left, pad 2 bytes var extraBytes = uint8.length % 3 // if we have 1 byte left, pad 2 bytes
var output = '' var output = ''
@ -124,6 +127,3 @@ function uint8ToBase64 (uint8) {
return parts.join('') return parts.join('')
} }
exports.toByteArray = b64ToByteArray
exports.fromByteArray = uint8ToBase64

Loading…
Cancel
Save