From 9eaba424933df3fc860dd6978584ba13a6d8e30a Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sun, 8 Mar 2020 18:32:23 -0400 Subject: [PATCH] version bump 0.10.3 - toString suffices for integers in the general format - separate currency sigil token --- README.md | 4 ++-- bits/01_version.js | 2 +- bits/40_general.js | 2 +- bits/82_eval.js | 1 + package.json | 37 +++++++++++++++++++++++++++++-------- ssf.flow.js | 7 ++++--- ssf.js | 7 ++++--- 7 files changed, 42 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9089973..c64f82f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376 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 @@ -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) -[![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) diff --git a/bits/01_version.js b/bits/01_version.js index 7654606..58084d3 100644 --- a/bits/01_version.js +++ b/bits/01_version.js @@ -1 +1 @@ -SSF.version = '0.10.2'; +SSF.version = '0.10.3'; diff --git a/bits/40_general.js b/bits/40_general.js index 67d1cb7..032a429 100644 --- a/bits/40_general.js +++ b/bits/40_general.js @@ -33,7 +33,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) { switch(typeof v) { case 'string': return v; 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 'object': if(v == null) return ""; diff --git a/bits/82_eval.js b/bits/82_eval.js index 5ff3776..cf750c9 100644 --- a/bits/82_eval.js +++ b/bits/82_eval.js @@ -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); out[out.length] = {t:'D', v:o}; break; case ' ': out[out.length] = {t:c, v:c}; ++i; break; + case "$": out[out.length] = {t:'t', v:'$'}; ++i; break; default: if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt); out[out.length] = {t:'t', v:c}; ++i; break; diff --git a/package.json b/package.json index 97259df..d6ad637 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { "name": "ssf", - "version": "0.10.2", + "version": "0.10.3", "author": "sheetjs", "description": "Format data using ECMA-376 spreadsheet Format Codes", - "keywords": [ "format", "sprintf", "spreadsheet" ], + "keywords": [ + "format", + "sprintf", + "spreadsheet" + ], "bin": { "ssf": "./bin/ssf.njs" }, @@ -13,14 +17,17 @@ "frac":"~1.1.2" }, "devDependencies": { - "mocha": "~2.5.3", - "blanket": "~1.2.3", "@sheetjs/uglify-js":"~2.7.3", "@types/node":"^8.0.7", + "blanket": "~1.2.3", "dtslint": "^0.1.2", + "mocha": "~2.5.3", "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": { "test": "make test", "build": "make", @@ -32,8 +39,22 @@ "pattern": "ssf.js" } }, - "homepage": "http://sheetjs.com/opensource", - "bugs": { "url": "https://github.com/SheetJS/ssf/issues" }, + "alex": { + "allow": [ + "special", + "simple", + "just", + "crash", + "wtf", + "holes" + ] + }, + "homepage": "http://sheetjs.com/", + "bugs": { + "url": "https://github.com/SheetJS/ssf/issues" + }, "license": "Apache-2.0", - "engines": { "node": ">=0.8" } + "engines": { + "node": ">=0.8" + } } diff --git a/ssf.flow.js b/ssf.flow.js index dd0607b..e10cc1d 100644 --- a/ssf.flow.js +++ b/ssf.flow.js @@ -4,7 +4,7 @@ /*:: declare var DO_NOT_EXPORT_SSF: any; */ var SSF/*:SSFModule*/ = ({}/*:any*/); 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 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;} @@ -171,7 +171,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) { switch(typeof v) { case 'string': return v; 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 'object': if(v == null) return ""; @@ -554,7 +554,7 @@ function fmt_is_date(fmt/*:string*/)/*:boolean*/ { while(i < fmt.length) { switch((c = fmt.charAt(i))) { 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; 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); out[out.length] = {t:'D', v:o}; break; case ' ': out[out.length] = {t:c, v:c}; ++i; break; + case "$": out[out.length] = {t:'t', v:'$'}; ++i; break; default: if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt); out[out.length] = {t:'t', v:c}; ++i; break; diff --git a/ssf.js b/ssf.js index cc86fea..30fc0f7 100644 --- a/ssf.js +++ b/ssf.js @@ -3,7 +3,7 @@ /*jshint -W041 */ var 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 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;} @@ -167,7 +167,7 @@ function general_fmt(v, opts) { switch(typeof v) { case 'string': return v; 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 'object': if(v == null) return ""; @@ -547,7 +547,7 @@ function fmt_is_date(fmt) { while(i < fmt.length) { switch((c = fmt.charAt(i))) { 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; 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); out[out.length] = {t:'D', v:o}; break; case ' ': out[out.length] = {t:c, v:c}; ++i; break; + case "$": out[out.length] = {t:'t', v:'$'}; ++i; break; default: if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt); out[out.length] = {t:'t', v:c}; ++i; break;