approximate-number
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36360
75