0.1.3 • Published 5 years ago

format-numerals v0.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Format Numerals

format-numerals is a JavaScript library to format numbers into strings based on various available configs

Build Status Greenkeeper badge Codecov branch GitHub tag (latest SemVer) GitHub

Install

$ npm install format-numerals

Usage

Common JS Module

const { formatNumerals }  = require('format-numerals')

// By default comma separator will be placed after every 3rd digit from
// left of decimal point
formatNumerals(100000.53)
// => "100,000.53"

// comma: 1, will follow Indian number system and will place comma separator
// after in 3-2-2... pattern
formatNumerals(100000, {comma: 1}
// => "1,00,000"

// curr: 'INR' will add currency symbol before the number string
formatNumerals(1000000, { curr: 'INR', comma: 1 })
// => "₹10,00,000"

formatNumerals(1000000, { curr: 'USD' })
// => "$1,000,000"

UMD

<script src="https://unpkg.com/format-numerals@0.1.2/dist/index.umd.js" />

<script>
  // FN will be added to global scope
  console.log(FN.formatNumerals(1000000))
  //// => "1,000,000"
</script>

License

MIT

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.2

5 years ago

0.0.0

5 years ago