Skip to content

Retina prototypes

Tobias Paczian edited this page Mar 20, 2018 · 4 revisions

Number

round

Number.round(decimals)

Rounds a number to decimals decimals.


baseSize

Number.baseSize()

Returns a formatted string of the number with , as a delimiter and a magnitude ending, e.g. 10,000 kbp.


byteSize

Number.byteSize()

Returns a formatted string of the number with , as a delimiter and a magnitude ending, e.g. 10,000 KB. The number is divided by 1024 for every magnitude.


timestring

Number.timestring(precision, long)

Converts a number of milliseconds into a string describing the time, e.g. 10 days 13 hours 12 minutes. If long is true, the magnitude descriptors will be words, i.e. minutes, if it is false it will be abbreviated, i.e. m. The precision is an integer where each number skips one magnitude. If precision is 1, the milliseconds will be skipped, 2 means seconds will be skipped and so forth.


formatString

Number.formatString(decimals, decimalSeparator, magnitudeSeparator)

Converts a number into a formatted string. The number will be rounded to decimals decimals. The decimalSeparator and magnitudeSeparator default to . and , respectively but can be changed to match the country formatting.


padLeft

Number.padLeft(base, character)

Converts the number into a string padded with character to the left until the resulting string has the same length as the string base. Default for base is 10 and the default character is 0.


Array

min

Array.max()

Returns the largest numerical value of the array.


min

Array.min()

Returns the smallest numerical value of the array.


String

hexDecode

String.hexDecode()

Returns the string representation of a hex encoded string.


hexEncode

String.hexEncode()

Returns the hex representation of a string.


capitalize

String.capitalize()

Returns the string with the first letter capitalized.

Clone this wiki locally