-
Notifications
You must be signed in to change notification settings - Fork 5
Retina prototypes
Number.round(decimals)
Rounds a number to decimals decimals.
Number.baseSize()
Returns a formatted string of the number with , as a delimiter and a magnitude ending, e.g. 10,000 kbp.
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.
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.
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.
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.max()
Returns the largest numerical value of the array.
Array.min()
Returns the smallest numerical value of the array.
String.hexDecode()
Returns the string representation of a hex encoded string.
String.hexEncode()
Returns the hex representation of a string.
String.capitalize()
Returns the string with the first letter capitalized.