forked from sheetjs/sheetjs
version bump 0.10.3
- toString suffices for integers in the general format - separate currency sigil token
This commit is contained in:
parent
fefb415467
commit
9eaba42493
@ -3,6 +3,8 @@
|
|||||||
ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376
|
ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376
|
||||||
spreadsheet format codes (used in popular spreadsheet software packages).
|
spreadsheet format codes (used in popular spreadsheet software packages).
|
||||||
|
|
||||||
|
This is the community version. We also offer a pro version with additional
|
||||||
|
features like international support as well as dedicated support.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -109,6 +111,4 @@ granted by the Apache 2.0 license are reserved by the Original Author.
|
|||||||
|
|
||||||
[![Dependencies Status](https://david-dm.org/sheetjs/ssf/status.svg)](https://david-dm.org/sheetjs/ssf)
|
[![Dependencies Status](https://david-dm.org/sheetjs/ssf/status.svg)](https://david-dm.org/sheetjs/ssf)
|
||||||
|
|
||||||
[![ghit.me](https://ghit.me/badge.svg?repo=sheetjs/js-xlsx)](https://ghit.me/repo/sheetjs/js-xlsx)
|
|
||||||
|
|
||||||
[![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/ssf?pixel)](https://github.com/SheetJS/ssf)
|
[![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/ssf?pixel)](https://github.com/SheetJS/ssf)
|
||||||
|
@ -1 +1 @@
|
|||||||
SSF.version = '0.10.2';
|
SSF.version = '0.10.3';
|
||||||
|
@ -33,7 +33,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) {
|
|||||||
switch(typeof v) {
|
switch(typeof v) {
|
||||||
case 'string': return v;
|
case 'string': return v;
|
||||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||||
case 'undefined': return "";
|
case 'undefined': return "";
|
||||||
case 'object':
|
case 'object':
|
||||||
if(v == null) return "";
|
if(v == null) return "";
|
||||||
|
@ -71,6 +71,7 @@ function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
|||||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||||
out[out.length] = {t:'D', v:o}; break;
|
out[out.length] = {t:'D', v:o}; break;
|
||||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||||
|
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||||
default:
|
default:
|
||||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||||
|
37
package.json
37
package.json
@ -1,9 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "ssf",
|
"name": "ssf",
|
||||||
"version": "0.10.2",
|
"version": "0.10.3",
|
||||||
"author": "sheetjs",
|
"author": "sheetjs",
|
||||||
"description": "Format data using ECMA-376 spreadsheet Format Codes",
|
"description": "Format data using ECMA-376 spreadsheet Format Codes",
|
||||||
"keywords": [ "format", "sprintf", "spreadsheet" ],
|
"keywords": [
|
||||||
|
"format",
|
||||||
|
"sprintf",
|
||||||
|
"spreadsheet"
|
||||||
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"ssf": "./bin/ssf.njs"
|
"ssf": "./bin/ssf.njs"
|
||||||
},
|
},
|
||||||
@ -13,14 +17,17 @@
|
|||||||
"frac":"~1.1.2"
|
"frac":"~1.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~2.5.3",
|
|
||||||
"blanket": "~1.2.3",
|
|
||||||
"@sheetjs/uglify-js":"~2.7.3",
|
"@sheetjs/uglify-js":"~2.7.3",
|
||||||
"@types/node":"^8.0.7",
|
"@types/node":"^8.0.7",
|
||||||
|
"blanket": "~1.2.3",
|
||||||
"dtslint": "^0.1.2",
|
"dtslint": "^0.1.2",
|
||||||
|
"mocha": "~2.5.3",
|
||||||
"typescript": "2.2.0"
|
"typescript": "2.2.0"
|
||||||
},
|
},
|
||||||
"repository": { "type":"git", "url":"git://github.com/SheetJS/ssf.git" },
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/SheetJS/ssf.git"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "make test",
|
"test": "make test",
|
||||||
"build": "make",
|
"build": "make",
|
||||||
@ -32,8 +39,22 @@
|
|||||||
"pattern": "ssf.js"
|
"pattern": "ssf.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"homepage": "http://sheetjs.com/opensource",
|
"alex": {
|
||||||
"bugs": { "url": "https://github.com/SheetJS/ssf/issues" },
|
"allow": [
|
||||||
|
"special",
|
||||||
|
"simple",
|
||||||
|
"just",
|
||||||
|
"crash",
|
||||||
|
"wtf",
|
||||||
|
"holes"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"homepage": "http://sheetjs.com/",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/SheetJS/ssf/issues"
|
||||||
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"engines": { "node": ">=0.8" }
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*:: declare var DO_NOT_EXPORT_SSF: any; */
|
/*:: declare var DO_NOT_EXPORT_SSF: any; */
|
||||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||||
SSF.version = '0.10.2';
|
SSF.version = '0.10.3';
|
||||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||||
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||||
@ -171,7 +171,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) {
|
|||||||
switch(typeof v) {
|
switch(typeof v) {
|
||||||
case 'string': return v;
|
case 'string': return v;
|
||||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||||
case 'undefined': return "";
|
case 'undefined': return "";
|
||||||
case 'object':
|
case 'object':
|
||||||
if(v == null) return "";
|
if(v == null) return "";
|
||||||
@ -554,7 +554,7 @@ function fmt_is_date(fmt/*:string*/)/*:boolean*/ {
|
|||||||
while(i < fmt.length) {
|
while(i < fmt.length) {
|
||||||
switch((c = fmt.charAt(i))) {
|
switch((c = fmt.charAt(i))) {
|
||||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||||
case '\\': i+=2; break;
|
case '\\': i+=2; break;
|
||||||
case '_': i+=2; break;
|
case '_': i+=2; break;
|
||||||
case '@': ++i; break;
|
case '@': ++i; break;
|
||||||
@ -663,6 +663,7 @@ function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
|||||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||||
out[out.length] = {t:'D', v:o}; break;
|
out[out.length] = {t:'D', v:o}; break;
|
||||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||||
|
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||||
default:
|
default:
|
||||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||||
|
7
ssf.js
7
ssf.js
@ -3,7 +3,7 @@
|
|||||||
/*jshint -W041 */
|
/*jshint -W041 */
|
||||||
var SSF = ({});
|
var SSF = ({});
|
||||||
var make_ssf = function make_ssf(SSF){
|
var make_ssf = function make_ssf(SSF){
|
||||||
SSF.version = '0.10.2';
|
SSF.version = '0.10.3';
|
||||||
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||||
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
||||||
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||||
@ -167,7 +167,7 @@ function general_fmt(v, opts) {
|
|||||||
switch(typeof v) {
|
switch(typeof v) {
|
||||||
case 'string': return v;
|
case 'string': return v;
|
||||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||||
case 'undefined': return "";
|
case 'undefined': return "";
|
||||||
case 'object':
|
case 'object':
|
||||||
if(v == null) return "";
|
if(v == null) return "";
|
||||||
@ -547,7 +547,7 @@ function fmt_is_date(fmt) {
|
|||||||
while(i < fmt.length) {
|
while(i < fmt.length) {
|
||||||
switch((c = fmt.charAt(i))) {
|
switch((c = fmt.charAt(i))) {
|
||||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||||
case '\\': i+=2; break;
|
case '\\': i+=2; break;
|
||||||
case '_': i+=2; break;
|
case '_': i+=2; break;
|
||||||
case '@': ++i; break;
|
case '@': ++i; break;
|
||||||
@ -656,6 +656,7 @@ function eval_fmt(fmt, v, opts, flen) {
|
|||||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||||
out[out.length] = {t:'D', v:o}; break;
|
out[out.length] = {t:'D', v:o}; break;
|
||||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||||
|
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||||
default:
|
default:
|
||||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||||
|
Loading…
Reference in New Issue
Block a user