version bump 0.10.3

- toString suffices for integers in the general format
- separate currency sigil token
This commit is contained in:
SheetJS 2020-03-08 18:32:23 -04:00
parent fefb415467
commit 9eaba42493
7 changed files with 42 additions and 18 deletions

View File

@ -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)

View File

@ -1 +1 @@
SSF.version = '0.10.2';
SSF.version = '0.10.3';

View File

@ -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 "";

View File

@ -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;

View File

@ -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"
}
}

View File

@ -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;

7
ssf.js
View File

@ -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;