updating to 0.12.6

This commit is contained in:
SheetJS 2018-03-19 18:14:14 -04:00
parent 4a204cff87
commit 0c54be4ec4
5 changed files with 56 additions and 34 deletions

View File

@ -1715,6 +1715,26 @@ describe('json output', function() {
assert.equal(json1[0].__EMPTY, 1);
assert.equal(json1[1].__EMPTY_1, 5);
});
it('should ignore errors and support default values', function() {
var ws = {
A1: {t:'s', v:"Field"}, B1: {t:'s', v:"Text"},
A2: {t:'e', v:0x2A, w:"#N/A" }, B2: {t:'s', v:"#N/A"},
A3: {t:'e', v:0x0F }, B3: {t:'s', v:"#VALUE!"},
A4: {t:'e', w:"#NAME?" }, B4: {t:'s', v:"#NAME?"},
"!ref": "A1:B4" };
seq(8).forEach(function(n) {
var opts = {};
if(n & 1) opts.header = 1;
if(n & 2) opts.raw = 1;
if(n & 4) opts.defval = null;
var J = X.utils.sheet_to_json(ws, opts);
// $FlowIgnore
for(var i = 0; i < 3; ++i) {
var k = ((n&1) ? J[i+1][0] : J[i].Field);
assert((n&4) ? (k === null) : (k !== null));
}
});
});
});

View File

@ -205,7 +205,7 @@ filenames.forEach(function(r) {
var ext = r[1] && r[1].bookType || r[0].split(".")[1];
ext = {"htm":"html"}[ext] || ext;
OUT.forEach(function(type) {
if(type == "string" && ["xlsx", "xlsm", "xlsb", "xlam", "biff8", "biff5", "xla", "ods", "dbf"].indexOf(ext) > -1) return;
if(type == "string" && ["xlsx", "xlsm", "xlsb", "xlam", "biff8", "biff5", "biff2", "xla", "ods", "dbf"].indexOf(ext) > -1) return;
if(type == "array" && ["xlsx", "xlsm", "xlsb", "xlam", "ods"].indexOf(ext) > -1 && typeof Uint8Array === 'undefined') return;
var datout = XLSX.write(wb, {type: type, bookType: ext, sheet:r[1] && r[1].sheet || null});
XLSX.read(datout, {type:type});

18
xlsx.core.min.js vendored

File diff suppressed because one or more lines are too long

32
xlsx.full.min.js vendored

File diff suppressed because one or more lines are too long

18
xlsx.js
View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
(function make_xlsx(XLSX){
XLSX.version = '0.12.5';
XLSX.version = '0.12.6';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -8323,7 +8323,7 @@ function parse_sty_bin(data, themes, opts) {
case 0x046A: /* 'BrtSlicerStyleElement' */
case 0x0200: /* 'BrtTableStyleElement' */
case 0x082F: /* 'BrtTimelineStyleElement' */
/* case 'BrtUid' */
case 0x0C00: /* 'BrtUid' */
break;
case 0x0023: /* 'BrtFRTBegin' */
@ -9154,7 +9154,8 @@ function parse_comments_bin(data, opts) {
if(!c.t) c.t = "";
delete c.rfx; out.push(c); break;
/* case 'BrtUid': */
case 0x0C00: /* 'BrtUid' */
break;
case 0x0023: /* 'BrtFRTBegin' */
pass = true; break;
@ -12964,7 +12965,6 @@ function parse_ws_bin(data, _opts, idx, rels, wb, themes, styles) {
case 0x01E5: /* 'BrtWsFmtInfo' */
break;
/* case 'BrtUid' */
case 0x00AF: /* 'BrtAFilterDateGroupItem' */
case 0x0284: /* 'BrtActiveX' */
case 0x0271: /* 'BrtBigName' */
@ -13014,6 +13014,7 @@ function parse_ws_bin(data, _opts, idx, rels, wb, themes, styles) {
case 0x0413: /* 'BrtSparkline' */
case 0x01AC: /* 'BrtTable' */
case 0x00AA: /* 'BrtTop10Filter' */
case 0x0C00: /* 'BrtUid' */
case 0x0032: /* 'BrtValueMeta' */
case 0x0816: /* 'BrtWebExtension' */
case 0x0415: /* 'BrtWsFmtInfoEx14' */
@ -13347,7 +13348,6 @@ function parse_cs_bin(data, opts, idx, rels, wb) {
if(val.name) wb.Sheets[idx].CodeName = val.name;
break;
/* case 'BrtUid': */
case 0x0232: /* 'BrtBkHim' */
case 0x028C: /* 'BrtCsPageSetup' */
case 0x029D: /* 'BrtCsProtection' */
@ -13355,6 +13355,7 @@ function parse_cs_bin(data, opts, idx, rels, wb) {
case 0x0227: /* 'BrtLegacyDrawing' */
case 0x0228: /* 'BrtLegacyDrawingHF' */
case 0x01DC: /* 'BrtMargins' */
case 0x0C00: /* 'BrtUid' */
break;
case 0x0023: /* 'BrtFRTBegin' */
@ -13900,8 +13901,8 @@ function parse_wb_bin(data, opts) {
break;
/* case 'BrtModelTimeGroupingCalcCol' */
/* case 'BrtRevisionPtr' */
/* case 'BrtUid' */
case 0x0C00: /* 'BrtUid' */
case 0x0C01: /* 'BrtRevisionPtr' */
case 0x0817: /* 'BrtAbsPath15' */
case 0x0216: /* 'BrtBookProtection' */
case 0x02A5: /* 'BrtBookProtectionIso' */
@ -17026,6 +17027,7 @@ var XLSBRecordEnum = {
0x085B: { n:"BrtBeginModelTimeGrouping" },
0x085C: { n:"BrtEndModelTimeGrouping" },
0x085D: { n:"BrtModelTimeGroupingCalcCol" },
0x0C00: { n:"BrtUid" },
0x0C01: { n:"BrtRevisionPtr" },
0xFFFF: { n:"" }
};
@ -19432,7 +19434,7 @@ function sheet_to_json(sheet, opts) {
v = val.v;
switch(val.t){
case 'z': if(v == null) break; continue;
case 'e': continue;
case 'e': v = void 0; break;
case 's': case 'd': case 'b': case 'n': break;
default: throw new Error('unrecognized type ' + val.t);
}