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

approximate-number

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

approximate-number - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

9

lib/approximate-number.js

@@ -14,3 +14,3 @@ /*jshint node:true, browser:true*/

function formatComma(num) {
function addCommas(num) {
if (num < 1000) {

@@ -23,3 +23,2 @@ return num.toString();

digits.reverse().forEach(function(digit, i){

@@ -51,3 +50,3 @@ if (i && i%3 === 0) {

// <1k: #,###; < 10k: #,###
numString = formatComma(num);
numString = addCommas(num);
} else if (num < 1000000) {

@@ -61,3 +60,3 @@ // < 100k: ##.#k; < 1m: ###k

// < 100b: ##.#b; >= 100b: #,###b
numString = formatComma(formatDec(num, 1000000000)) + "b";
numString = addCommas(formatDec(num, 1000000000)) + "b";
}

@@ -72,2 +71,4 @@

approximate.addCommas = addCommas;
if (typeof module === 'object') {

@@ -74,0 +75,0 @@ // node.js/common js

{
"name": "approximate-number",
"version": "1.0.4",
"version": "1.1.0",
"main": "lib/approximate-number.js",

@@ -44,3 +44,7 @@ "description": "Converts numbers into a more human-friendly format. For example, 123456 becomes '123k'.",

"scripts": {
"test": "grunt"
"test": "grunt",
"version-patch": "npm version patch && bower version patch",
"version-minor": "npm version minor && bower version minor",
"prepublish": "npm test",
"postpublish": "git push --tags && bower register approximate-number git://github.com/nfriedly/approximate-number.git"
},

@@ -47,0 +51,0 @@ "bin": {

Sorry, the diff of this file is not supported yet

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