module:MMoney

module:MMoney

Class to operate on money.

Constructor

new (require("MMoney"))()

Description:
  • Constructor.

Extends

Methods

currency() → {Object}

Description:
  • Property method.

Returns:

Currency.

Type
Object

setCurrency(code, symbol, name, plural, exponent)

Description:
  • Set currency.

Parameters:
Name Type Description
code string

Code.

symbol string

Symbol.

name string

Name.

plural string

Plural name.

exponent number

Exponent.

setCurrencyByJSONObject(object)

Description:
  • Set currency by object.

    object must contain the following keys.

    • code
    • symbol
    • name
    • plural
    • exponent
Parameters:
Name Type Description
object JSON

Object.

getValueWithSymbolAsString() → {string}

Description:
  • Get the value as string with the currency symbol.

Returns:

Value.

Type
string

subtract(money) → {MMoney}

Description:
  • Subtract given money from this money instance.

Parameters:
Name Type Description
money MMoney

Money.

Returns:

Money.

Type
MMoney

sum(money) → {MMoney}

Description:
  • Sum given money with this money instance.

Parameters:
Name Type Description
money MMoney

Money.

Returns:

Money.

Type
MMoney

value() → {number}

Description:
  • Property method.

Overrides:
Returns:

Value.

Type
number

setValue(value)

Description:
  • Set value.

Overrides:
Parameters:
Name Type Description
value number | string

Value.

getValueAsString() → {string}

Description:
  • Get the value as string.

Overrides:
Returns:

Value.

Type
string

valueOf() → {number}

Description:
  • Value of this class.

Overrides:
Returns:

Value.

Type
number