Skip to content

aervin/cur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI styled with prettier minified

cur

A helper function for currency formatting.

Installation:

npm i -S cur@latest

Interface:

cur(
    figureToBeFormatted: number,
    returnDollarsAndCents: boolean, 
    config: { thousandsSeparator: string, decimalSeparator: string }
) => string | undefined

Example:

import cur from 'cur'

`$${cur(1234.56)}`
// "$1,235"

Example with cents:

`$${cur(1234.56, true)}`
// "$1,234.56"

Separators:

cur accepts an optional config argument with two properties, thousandsSeparator and decimalSeparator.

'$' + cur(1234.56, true, { thousandsSeparator: "'", decimalSeparator: "," })
// "$1'234,56"

About

It formats currency using Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published