Fork me on GitHub

Global

Members

(constant) Defaults :Object

Default values for all Dinero objects.

You can override default values for all subsequent Dinero objects by changing them directly on the global Dinero object. Existing instances won't be affected.

Properties:
Name Type Description
defaultAmount Number

The default amount for new Dinero objects (see Dinero for format).

defaultCurrency String

The default currency for new Dinero objects (see Dinero for format).

defaultPrecision Number

The default precision for new Dinero objects (see Dinero for format).

Source:
Example
// Will set currency to 'EUR' for all Dinero objects.
Dinero.defaultCurrency = 'EUR'

(constant) Globals :Object

Global settings for all Dinero objects.

You can override global values for all subsequent Dinero objects by changing them directly on the global Dinero object. Existing instances won't be affected.

Properties:
Name Type Description
globalLocale String

The global locale for new Dinero objects (see setLocale for format).

globalFormat String

The global format for new Dinero objects (see toFormat for format).

globalRoundingMode String

The global rounding mode for new Dinero objects (see multiply or divide for format).

globalFormatRoundingMode String

The global rounding mode to format new Dinero objects (see toFormat or toRoundedUnit for format).

globalExchangeRatesApi.endpoint String

The global exchange rate API endpoint for new Dinero objects (see convert for format).

globalExchangeRatesApi.propertyPath String

The global exchange rate API property path for new Dinero objects (see convert for format).

globalExchangeRatesApi.headers Object

The global exchange rate API headers for new Dinero objects (see convert for format).

Source:
Examples
// Will set locale to 'fr-FR' for all Dinero objects.
Dinero.globalLocale = 'fr-FR'
// Will set global exchange rate API parameters for all Dinero objects.
Dinero.globalExchangeRatesApi = {
 endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
 propertyPath: 'data.rates.{{to}}',
 headers: {
   'user-key': 'xxxxxxxxx'
 }
}