Code Monkey home page Code Monkey logo

comma-number's Introduction

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

comma-number's People

Contributors

cesarandreu avatar

Stargazers

moeagame avatar Shawn Wang avatar Ashley Wilson avatar nichoth avatar xcatliu avatar Filip Malinowski avatar Matheus Alves avatar Angus H. avatar Javier Arce avatar retornam avatar Nacho García Fernández avatar Tom MacWright avatar

Watchers

 avatar  avatar

comma-number's Issues

Accounting for different styles of separating digits

According to this and from personal experience, there are numerous styles used around the globe to separate digits in a number, which include:

  • Style A: 10,000,000,000
  • Style B: 10 000 000 000
  • Style C: 10.000.000.000
  • Style D: 10’000’000’000
  • Style E: 10˙000˙000˙000
  • Style F: 100,0000,0000
  • Style G: 10,00,00,00,000

Possibly account for these different styles?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.