debugging mobile safari

This commit is contained in:
AJ ONeal 2015-10-23 02:39:29 -07:00
parent 51ab2d9797
commit 92b62946d3
1 changed files with 6 additions and 1 deletions

View File

@ -95,6 +95,7 @@ exports.base32ToBuffer = function(encoded) {
} else {
decoded = new Array(len);
}
console.log('debug mobile safari: decoded', decoded);
/* byte by byte isn't as pretty as octet by octet but tests a bit
faster. will have to revisit. */
@ -131,11 +132,15 @@ exports.base32ToBuffer = function(encoded) {
throw new Error('Invalid input - it is not base32 encoded string');
}
}
console.log('debug mobile safari: decoded 2', decoded);
if (decoded.slice) {
console.log('debug mobile safari: decoded 3a', decoded);
return decoded.slice(0, plainPos);
} else {
console.log('debug mobile safari: decoded 3b', decoded);
// Mobile Safari's Uint8Array doesn't have slice
return Array.prototype.slice.call(decoded, 0, plainPos);
return new Uint8Array(Array.prototype.slice.call(decoded, 0, plainPos));
}
};