From ea400ab67014a5143d09d9f779679e7ef4303faa Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 23 Oct 2015 03:13:27 -0700 Subject: [PATCH] polyfill Mobile Safari's missing slice --- unibabel.base32.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unibabel.base32.js b/unibabel.base32.js index 219f815..8a0baac 100644 --- a/unibabel.base32.js +++ b/unibabel.base32.js @@ -131,11 +131,11 @@ exports.base32ToBuffer = function(encoded) { throw new Error('Invalid input - it is not base32 encoded string'); } } - if (decoded.slice) { + + if (decoded.slice) { // Array or TypedArray return decoded.slice(0, plainPos); - } else { - // Mobile Safari's Uint8Array doesn't have slice - return Array.prototype.slice.call(decoded, 0, plainPos); + } else { // Mobile Safari TypedArray + return new Uint8Array(Array.prototype.slice.call(decoded, 0, plainPos)); } };