Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssf

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssf - npm Package Compare versions

Comparing version 0.5.9 to 0.5.10

test/comma.js

2

package.json
{
"name": "ssf",
"version": "0.5.9",
"version": "0.5.10",
"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.9';
SSF.version = '0.5.10';
/* Options */

@@ -209,2 +209,4 @@ var opts_fmt = {};

if(mul !== 0) return write_num(type, fmt, val * Math.pow(10,2*mul)) + fill("%",mul);
fmt = fmt.replace(/(\.0+)(,+)$/g,function($$,$1,$2) { mul=$2.length; return $1; });
if(mul !== 0) return write_num(type, fmt, val / Math.pow(10,3*mul));
if(fmt.indexOf("E") > -1) {

@@ -243,7 +245,8 @@ var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;

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); });
rr = 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); });
return fmt.match(/0\./) ? rr : rr.replace(/^0\./,".");
}
fmt = fmt.replace(/^#+0/, "0");
fmt = fmt.replace(/^#+([0.])/, "$1");
if((r = fmt.match(/^(0*)\.(#*)$/))) {

@@ -250,0 +253,0 @@ o = Math.round(aval*Math.pow(10,r[2].length));

@@ -369,2 +369,10 @@ # SSF

Formats with multiple commas after the decimal point should be shifted by the
appropiate multiple of 1000 (more magic):
```js>tmp/60_number.js
fmt = fmt.replace(/(\.0+)(,+)$/g,function($$,$1,$2) { mul=$2.length; return $1; });
if(mul !== 0) return write_num(type, fmt, val / Math.pow(10,3*mul));
```
For exponents, get the exponent and mantissa and format them separately:

@@ -431,5 +439,6 @@

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); });
rr = 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); });
return fmt.match(/0\./) ? rr : rr.replace(/^0\./,".");
}

@@ -441,3 +450,3 @@ ```

```
fmt = fmt.replace(/^#+0/, "0");
fmt = fmt.replace(/^#+([0.])/, "$1");
if((r = fmt.match(/^(0*)\.(#*)$/))) {

@@ -1008,3 +1017,3 @@ o = Math.round(aval*Math.pow(10,r[2].length));

"name": "ssf",
"version": "0.5.9",
"version": "0.5.10",
"author": "SheetJS",

@@ -1011,0 +1020,0 @@ "description": "pure-JS library to format data using ECMA-376 spreadsheet Format Codes",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc