format

Formatting data

Source:
Since:
  • 0.0.32

Methods

(inner) format(value, type, is_display, decimal_places) → {number|string}

Source:

For formatting values with data types

Parameters:
Name Type Default Description
value

Value passed in to change

type string

Data type e.g string, number

is_display boolean true

to determine whether return a string and will handle decimal from being rounded

decimal_places number 0

decimal places to round to

Returns:
Type
number | string

(inner) formatStruct(skv_items, type, is_display, decimal_places) → {struct}

Source:

Where we want to format an entire struct in the same way

Parameters:
Name Type Default Description
skv_items struct

Struct of values passed in to change

type string

Data type e.g string, number

is_display boolean true

to determine whether return a string and will handle decimal from being rounded

decimal_places number 0

decimal places to round to

Returns:

Struct of values changed

Type
struct

(inner) numberWithCommas(number, decimal_places) → {string}

Source:

Format to use commas and decimal places

Parameters:
Name Type Default Description
number number
decimal_places number 2
Returns:
Type
string