base64-arraybuffer-es6
Advanced tools
Comparing version 0.4.1 to 0.4.2
# base64-arraybuffer-es6 | ||
## 0.4.2 | ||
- Fix: Overcome Safari's idiosyncrasies with `Uint8Array` constructor | ||
(@dfahlander). | ||
## 0.4.1 | ||
@@ -4,0 +9,0 @@ |
@@ -17,4 +17,9 @@ /* | ||
var encode = function encode(arraybuffer, byteOffset, length) { | ||
var bytes = new Uint8Array(arraybuffer, byteOffset, length), | ||
len = bytes.length; | ||
if (length === null || length === undefined) { | ||
length = arraybuffer.byteLength; // Needed for Safari | ||
} | ||
var bytes = new Uint8Array(arraybuffer, byteOffset || 0, // Default needed for Safari | ||
length); | ||
var len = bytes.length; | ||
var base64 = ''; | ||
@@ -21,0 +26,0 @@ |
@@ -23,4 +23,9 @@ (function (global, factory) { | ||
var encode = function encode(arraybuffer, byteOffset, length) { | ||
var bytes = new Uint8Array(arraybuffer, byteOffset, length), | ||
len = bytes.length; | ||
if (length === null || length === undefined) { | ||
length = arraybuffer.byteLength; // Needed for Safari | ||
} | ||
var bytes = new Uint8Array(arraybuffer, byteOffset || 0, // Default needed for Safari | ||
length); | ||
var len = bytes.length; | ||
var base64 = ''; | ||
@@ -27,0 +32,0 @@ |
{ | ||
"name": "base64-arraybuffer-es6", | ||
"description": "Encode/decode base64 data into ArrayBuffers", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"homepage": "https://github.com/brettz9/base64-arraybuffer", | ||
@@ -6,0 +6,0 @@ "author": "Brett Zamir", |
@@ -18,6 +18,13 @@ /* | ||
export const encode = function (arraybuffer, byteOffset, length) { | ||
const bytes = new Uint8Array(arraybuffer, byteOffset, length), | ||
len = bytes.length; | ||
if (length === null || length === undefined) { | ||
length = arraybuffer.byteLength; // Needed for Safari | ||
} | ||
const bytes = new Uint8Array( | ||
arraybuffer, | ||
byteOffset || 0, // Default needed for Safari | ||
length | ||
); | ||
const len = bytes.length; | ||
let base64 = ''; | ||
for (let i = 0; i < len; i += 3) { | ||
@@ -24,0 +31,0 @@ base64 += chars[bytes[i] >> 2]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11265
185