SSF undefined string guard (fixes #584)

note: @sheetjsdev authored commit, original PR date/author used
This commit is contained in:
LieJiang 2017-03-22 23:21:01 +08:00 committed by SheetJS
parent a846f7184d
commit d83986d31c
4 changed files with 4 additions and 1 deletions

@ -201,6 +201,7 @@ function write_sst_xml(sst/*:SST*/, opts)/*:string*/ {
if(s.r) sitag += s.r;
else {
sitag += "<t";
if(!s.t) s.t = "";
if(s.t.match(straywsregex)) sitag += ' xml:space="preserve"';
sitag += ">" + escapexml(s.t) + "</t>";
}

@ -1156,7 +1156,7 @@ describe('json output', function() {
it('should handle raw data if requested', function() {
var _ws = sheet_from_array_of_arrays(data, {cellDates:true});
var json = X.utils.sheet_to_json(_ws, {header:1, raw:true});
console.log(json, typeof json[2][2]);
//console.log(json, typeof json[2][2]);
assert.equal(json.length, data.length);
assert.equal(json[1][0], true);
assert.equal(json[2][1], "bar");

@ -4812,6 +4812,7 @@ function write_sst_xml(sst/*:SST*/, opts)/*:string*/ {
if(s.r) sitag += s.r;
else {
sitag += "<t";
if(!s.t) s.t = "";
if(s.t.match(straywsregex)) sitag += ' xml:space="preserve"';
sitag += ">" + escapexml(s.t) + "</t>";
}

@ -4758,6 +4758,7 @@ function write_sst_xml(sst, opts) {
if(s.r) sitag += s.r;
else {
sitag += "<t";
if(!s.t) s.t = "";
if(s.t.match(straywsregex)) sitag += ' xml:space="preserve"';
sitag += ">" + escapexml(s.t) + "</t>";
}