Comparing version 0.0.6 to 0.0.7
@@ -6,3 +6,3 @@ /* harb.js (C) 2014 SheetJS -- http://sheetjs.com */ | ||
(function make_harb (HARB) { | ||
HARB.version = '0.0.6'; | ||
HARB.version = '0.0.7'; | ||
if (typeof exports !== 'undefined') { | ||
@@ -74,6 +74,2 @@ if (typeof module !== 'undefined' && module.exports) { | ||
else if(d === 'FALSE') data[R][C] = false; | ||
else if(typeof d === 'string') { | ||
var dt = new Date(d); | ||
if(dt.getDate() === dt.getDate()) data[R][C] = dt; | ||
} | ||
} | ||
@@ -103,14 +99,10 @@ return data; | ||
if (data === 'BOT') { arr[++R] = []; C = 0; continue; } | ||
else if (data === 'EOD') break; | ||
else throw new Error("Unrecognized DIF special command " + data); | ||
break; /* technically unreachable */ | ||
else if (data !== 'EOD') throw new Error("Unrecognized DIF special command " + data); | ||
break; | ||
case 0: | ||
if(data === 'TRUE') arr[R][C++] = true; | ||
else if(data === 'FALSE') arr[R][C++] = false; | ||
else if(+value == +value) arr[R][C++] = +value; | ||
else { | ||
var d = new Date(value); | ||
if(d.getDate() === d.getDate()) arr[R][C++] = d; | ||
} | ||
break; | ||
if(data === 'TRUE') arr[R][C] = true; | ||
else if(data === 'FALSE') arr[R][C] = false; | ||
else if(+value == +value) arr[R][C] = +value; | ||
else arr[R][C] = value; | ||
++C; break; | ||
case 1: | ||
@@ -204,3 +196,4 @@ data = data.substr(1,data.length-2); | ||
var read = function (f, opts) { | ||
var read = function (f, opts, hint) { | ||
if(hint === 0xFFFE) return csv_to_workbook(f); | ||
if(f.substr(0, 5) === 'TABLE' && f.substr(0, 12).indexOf('0,1') > -1) return dif_to_workbook(f); | ||
@@ -216,3 +209,3 @@ else if(f.substr(0,2) === 'ID') return sylk_to_workbook(f); | ||
var b = fs.readFileSync(f); | ||
if(((b[0]<<8)|b[1])==0xFFFE) return read(cptable.utils.decode(1200, b.slice(2)), o); | ||
if(((b[0]<<8)|b[1])==0xFFFE) return read(cptable.utils.decode(1200, b.slice(2)), o, 0xFFFE); | ||
return read(b.toString(), o); | ||
@@ -219,0 +212,0 @@ }; |
29
harb.js
@@ -6,3 +6,3 @@ /* harb.js (C) 2014 SheetJS -- http://sheetjs.com */ | ||
(function make_harb (HARB) { | ||
HARB.version = '0.0.6'; | ||
HARB.version = '0.0.7'; | ||
if (typeof exports !== 'undefined') { | ||
@@ -74,6 +74,2 @@ if (typeof module !== 'undefined' && module.exports) { | ||
else if(d === 'FALSE') data[R][C] = false; | ||
else if(typeof d === 'string') { | ||
var dt = new Date(d); | ||
if(dt.getDate() === dt.getDate()) data[R][C] = dt; | ||
} | ||
} | ||
@@ -103,14 +99,10 @@ return data; | ||
if (data === 'BOT') { arr[++R] = []; C = 0; continue; } | ||
else if (data === 'EOD') break; | ||
else throw new Error("Unrecognized DIF special command " + data); | ||
break; /* technically unreachable */ | ||
else if (data !== 'EOD') throw new Error("Unrecognized DIF special command " + data); | ||
break; | ||
case 0: | ||
if(data === 'TRUE') arr[R][C++] = true; | ||
else if(data === 'FALSE') arr[R][C++] = false; | ||
else if(+value == +value) arr[R][C++] = +value; | ||
else { | ||
var d = new Date(value); | ||
if(d.getDate() === d.getDate()) arr[R][C++] = d; | ||
} | ||
break; | ||
if(data === 'TRUE') arr[R][C] = true; | ||
else if(data === 'FALSE') arr[R][C] = false; | ||
else if(+value == +value) arr[R][C] = +value; | ||
else arr[R][C] = value; | ||
++C; break; | ||
case 1: | ||
@@ -204,3 +196,4 @@ data = data.substr(1,data.length-2); | ||
var read = function (f, opts) { | ||
var read = function (f, opts, hint) { | ||
if(hint === 0xFFFE) return csv_to_workbook(f); | ||
if(f.substr(0, 5) === 'TABLE' && f.substr(0, 12).indexOf('0,1') > -1) return dif_to_workbook(f); | ||
@@ -216,3 +209,3 @@ else if(f.substr(0,2) === 'ID') return sylk_to_workbook(f); | ||
var b = fs.readFileSync(f); | ||
if(((b[0]<<8)|b[1])==0xFFFE) return read(cptable.utils.decode(1200, b.slice(2)), o); | ||
if(((b[0]<<8)|b[1])==0xFFFE) return read(cptable.utils.decode(1200, b.slice(2)), o, 0xFFFE); | ||
return read(b.toString(), o); | ||
@@ -219,0 +212,0 @@ }; |
{ | ||
"name": "harb", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"author": "sheetjs", | ||
@@ -5,0 +5,0 @@ "description": "Plaintext spreadsheet (DIF / CSV / TSV / SocialCalc) parser", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
407905
2912