Home Manual Reference Source Repository

Typedef

Static Public Summary
public

CurrencyFormat: Format

Currency format interface.

public

The library's settings configuration interface.

Static Public

public CurrencyFormat: Format source

Currency format interface.

Each property represents template string used by formatMoney. Inside this template you can use these patterns:

  • %s - Currency symbol
  • %v - Amount

Examples:

'%s %v'   => '$ 1.00'
'%s (%v)' => '$ (1.00)'
'%s  -- ' => '$  --'

Properties:

NameTypeAttributeDescription
pos String

Currency format for positive values

neg String
  • optional
  • default: pos

Currency format for positive values

zero String
  • optional
  • default: pos

Currency format for positive values

public Settings: Object source

The library's settings configuration interface.

Properties:

NameTypeAttributeDescription
symbol String
  • optional
  • default: '$'

Currency symbol

format String | CurrencyFormat
  • optional
  • default: '%s%v'

Controls output: %s = symbol, %v = value (can be object, see docs)

decimal String
  • optional
  • default: '.'

Decimal point separator

thousand String
  • optional
  • default: ',

Thousands separator

precision Number
  • optional
  • default: 2

Number of decimal places to round the amount to

grouping Number
  • optional
  • default: 3

Digit grouping (not implemented yet)

stripZeros Boolean
  • optional
  • default: false

Strip insignificant zeros from decimal part

fallback Float
  • optional
  • default: 0

Value returned on unformat() failure