Comparing version 0.5.3 to 0.5.4
{ | ||
"name": "ssf", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"author": "SheetJS", | ||
@@ -5,0 +5,0 @@ "description": "pure-JS library to format data using ECMA-376 spreadsheet Format Codes", |
@@ -8,3 +8,3 @@ /* ssf.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ | ||
function rpad(v,d,c){var t=String(v);return t.length>=d?t:(t+fill(c||0,d-t.length));} | ||
SSF.version = '0.5.3'; | ||
SSF.version = '0.5.4'; | ||
/* Options */ | ||
@@ -239,7 +239,7 @@ var opts_fmt = {}; | ||
if(fmt.match(/^[#?]+$/)) return String(Math.round(val)).replace(/^0$/,""); | ||
if(r = fmt.match(/^#*0+\.(0+)/)) { | ||
if((r = fmt.match(/^#*0+\.(0+)/))) { | ||
o = Math.round(val * Math.pow(10,r[1].length)); | ||
return String(o/Math.pow(10,r[1].length)).replace(/^([^\.]+)$/,"$1."+r[1]).replace(/\.$/,"."+r[1]).replace(/\.([0-9]*)$/,function($$, $1) { return "." + $1 + fill("0", r[1].length-$1.length); }); | ||
} | ||
if(r = fmt.match(/^# ([?]+)([ ]?)\/([ ]?)([?]+)/)) { | ||
if((r = fmt.match(/^# ([?]+)([ ]?)\/([ ]?)([?]+)/))) { | ||
var rr = Math.min(Math.max(r[1].length, r[4].length),7); | ||
@@ -407,2 +407,3 @@ ff = frac(aval, Math.pow(10,rr)-1, true); | ||
if(v === true) v = "TRUE"; if(v === false) v = "FALSE"; | ||
if(v === "" || typeof v === "undefined") return ""; | ||
return eval_fmt(f[1], v, o, f[0]); | ||
@@ -409,0 +410,0 @@ }; |
15
ssf.md
@@ -423,3 +423,3 @@ # SSF | ||
if(fmt.match(/^[#?]+$/)) return String(Math.round(val)).replace(/^0$/,""); | ||
if(r = fmt.match(/^#*0+\.(0+)/)) { | ||
if((r = fmt.match(/^#*0+\.(0+)/))) { | ||
o = Math.round(val * Math.pow(10,r[1].length)); | ||
@@ -433,3 +433,3 @@ return String(o/Math.pow(10,r[1].length)).replace(/^([^\.]+)$/,"$1."+r[1]).replace(/\.$/,"."+r[1]).replace(/\.([0-9]*)$/,function($$, $1) { return "." + $1 + fill("0", r[1].length-$1.length); }); | ||
``` | ||
if(r = fmt.match(/^# ([?]+)([ ]?)\/([ ]?)([?]+)/)) { | ||
if((r = fmt.match(/^# ([?]+)([ ]?)\/([ ]?)([?]+)/))) { | ||
var rr = Math.min(Math.max(r[1].length, r[4].length),7); | ||
@@ -581,3 +581,3 @@ ff = frac(aval, Math.pow(10,rr)-1, true); | ||
Conditional and color blocks should be handled at one point (TODO). The | ||
Conditional and color blocks should be handled at one point (TODO). The | ||
pseudo-type `Z` is used to capture absolute time blocks: | ||
@@ -776,3 +776,3 @@ | ||
In the case of one format, if it contains an "@" then it is a text format. | ||
In the case of one format, if it contains an "@" then it is a text format. | ||
There is a big TODO here regarding how to best handle this case. | ||
@@ -820,3 +820,6 @@ | ||
Empty string should always emit empty, even if there are other characters: | ||
``` | ||
if(v === "" || typeof v === "undefined") return ""; | ||
return eval_fmt(f[1], v, o, f[0]); | ||
@@ -958,3 +961,3 @@ }; | ||
"name": "ssf", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"author": "SheetJS", | ||
@@ -1003,3 +1006,3 @@ "description": "pure-JS library to format data using ECMA-376 spreadsheet Format Codes", | ||
- "npm install coveralls mocha-lcov-reporter" | ||
after_success: | ||
after_success: | ||
- "make coveralls" | ||
@@ -1006,0 +1009,0 @@ ``` |
@@ -21,3 +21,3 @@ [ | ||
["\\r", [1, "r"], [-1, "r"], [0, "r"], ["TODO","TODO"]], | ||
["_($* #,##0_);_($* (#,##0);_($* \"-\"_);_(@_)", [1, " $1 "], [-1, " $(1)"], [0," $- "], ["TODO", " TODO "]], | ||
["_($* #,##0_);_($* (#,##0);_($* \"-\"_);_(@_)", [1, " $1 "], [-1, " $(1)"], [0," $- "], ["TODO", " TODO "], ["",""]], | ||
["#,##0.0", [1,"1.0"], [-1,"-1.0"], [0,"0.0"], ["TODO","TODO"]], | ||
@@ -24,0 +24,0 @@ ["#,##0.00", [1,"1.00"], [-1,"-1.00"], [0,"0.00"], ["TODO","TODO"]], |
Sorry, the diff of this file is not supported yet
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
102601
1903