Skip to content

nib-health-funds/format-decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

format-decimal

Format decimal numbers.

Installation

NPM:

npm install --save @nib/format-decimal

Component:

component install nib-health-funds/format-decimal

Usage

var decimal = require('format-decimal');
var price   = decimal.format(1699, {places: 2, separator: ','});
console.log(price); //prints "1,699.00"

API

.round(number, places)

Rounds the number to the specified number of places.

.format(number, options)

Formats the number.

  • places - The number of places to round
  • separator - The number separator