comma-numbers
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -17,5 +17,5 @@ module.exports = Comma; | ||
characteristic = reverse(characteristic); | ||
characteristic = characteristic.replace(/(\d{3})/g, '$1' + reverse(options.thousandSeparator)); | ||
characteristic = characteristic.replace(/(\d{3})(?!$)/g, '$1' + reverse(options.thousandSeparator)); | ||
characteristic = reverse(characteristic); | ||
return hasMantissa ? characteristic + options.decimalSeparator + mantissa : characteristic; | ||
@@ -22,0 +22,0 @@ } |
{ | ||
"name": "comma-numbers", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "format numbers with commas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var Comma = require('../'); | ||
var comma = Comma(); | ||
var assert = require('assert'); | ||
describe ('comma', function () { | ||
var comma; | ||
beforeEach(function () { | ||
comma = Comma(); | ||
}); | ||
it ('should keep the given precision', function () { | ||
@@ -32,2 +37,6 @@ assert.equal('1,200.42', comma(1200.42)); | ||
}); | ||
it ('should not comma 100s numbers', function () { | ||
assert.equal('500', comma(500)); | ||
}); | ||
}); |
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
2946
59