New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-countup

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-countup - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

6

build/index.js

@@ -29,3 +29,4 @@ 'use strict';

var formatNumber = exports.formatNumber = function formatNumber(start, options) {
var num = '' + start.toFixed(options.decimals);
var neg = start < 0;
var num = '' + Math.abs(start).toFixed(options.decimals);
var x = num.split('.');

@@ -41,3 +42,4 @@ var x1 = x[0];

}
return '' + options.prefix + x1 + x2 + options.suffix;
return '' + (neg ? '-' : '') + (options.prefix || '') + x1 + x2 + (options.suffix || '');
};

@@ -44,0 +46,0 @@

{
"name": "react-countup",
"version": "3.0.1",
"version": "3.0.2",
"description": "A React component wrapper around CountUp.js",

@@ -5,0 +5,0 @@ "author": "Glenn Reyes <glenn@glennreyes.com> (https://twitter.com/glnnrys)",

@@ -100,5 +100,2 @@ # [React CountUp](https://glennreyes.github.io/react-countup)

##### `useGrouping`: boolean
Group thousands by [separator character](#separator-string)
##### `separator`: string

@@ -105,0 +102,0 @@ Specifies character of thousands separator

@@ -75,1 +75,10 @@ import React from 'react';

});
it('formats negative number with separator correctly', () => {
const formattedNumber = formatNumber(-123456.789, {
decimal: '.',
decimals: 2,
separator: ' ',
});
expect(formattedNumber).toBe('-123 456.79');
});

@@ -40,3 +40,4 @@ // @flow

export const formatNumber: FormatNumberFn = (start, options) => {
const num = `${start.toFixed(options.decimals)}`;
const neg = start < 0;
const num = `${Math.abs(start).toFixed(options.decimals)}`;
const x = num.split('.');

@@ -52,3 +53,5 @@ let x1 = x[0];

}
return `${options.prefix}${x1}${x2}${options.suffix}`;
return `${neg ? '-' : ''}${options.prefix || ''}${x1}${x2}${options.suffix ||
''}`;
};

@@ -55,0 +58,0 @@

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