added Array.isArray to shim

This commit is contained in:
SheetJS 2014-07-22 12:28:39 -04:00
parent b8e6536323
commit 03c6b0f255
2 changed files with 12 additions and 2 deletions

@ -22,6 +22,8 @@
</head>
<body>
<b>JS-XLSX (XLSX/XLSB/XLSM) Live Demo</b><br />
<a href="https://github.com/SheetJS/js-xlsx">Github Repo</a><br />
<a href="https://github.com/SheetJS/js-xlsx/issues">Issues? Something look weird? Click here and report an issue</a><br />
Output Format:
<select name="format">
<option value="csv" selected> CSV</option>
@ -59,12 +61,14 @@ if(!use_worker) {
document.getElementsByName("useworker")[0].checked = false;
}
var transferable = true;
var transferable = use_worker;
if(!transferable) {
document.getElementsByName("xferable")[0].disabled = true;
document.getElementsByName("xferable")[0].checked = false;
}
var wtf_mode = false;
function fixdata(data) {
var o = "", l = 0, w = 10240;
for(; l<data.byteLength/w; ++l) o+=String.fromCharCode.apply(null,new Uint8Array(data.slice(l*w,l*w+w)));
@ -170,7 +174,7 @@ function to_formulae(workbook) {
var tarea = document.getElementById('b64data');
function b64it() {
if(typeof console !== 'undefined') console.log("onload", new Date());
var wb = XLSX.read(tarea.value, {type: 'base64'});
var wb = XLSX.read(tarea.value, {type: 'base64',WTF:wtf_mode});
process_wb(wb);
}

@ -200,7 +200,13 @@ if (!Array.prototype.indexOf) {
return -1;
};
}
// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
if (! Array.isArray) {
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
};
}
// https://github.com/ttaubert/node-arraybuffer-slice
// (c) 2013 Tim Taubert <tim@timtaubert.de>