Skip to content

cesarandreu/comma-number

Repository files navigation

Comma number

NPM version build status

Installation

$ npm install comma-number

Usage

var commaNumber = require('comma-number')

commaNumber(1000) // "1,000"
commaNumber(-1000) // "-1,000"
commaNumber(-1000, '.') // "-1.000"

API

commaNumber(number, [separator=','])

Parameters:

  • number : {(Number|String)} Number to format
  • separator : {String} Value used to separate numbers

Returns:

  • {String} Comma formatted number

Tests

$ npm test

License

MIT