Methods
(static) convert(string, oldBase, newBase) → {string}
Parameters:
Name |
Type |
Description |
string |
string
|
A number. |
oldBase |
number
|
A current base of the number. |
newBase |
number
|
The base you want. |
- Source:
Returns:
-
Type
-
string
Example
convert('1010', 2, 5); // -> '20'
convert('200', 8, 62); // -> '24'
(static) parse(string, base) → {number}
Parameters:
Name |
Type |
Description |
string |
string
|
A number to convert to the decimal base. |
base |
number
|
Original base of the number. |
- Source:
Returns:
Decimal representation of the number.
-
Type
-
number
Example
parse('NK7qkfsZSrqYB7KGPtq9zoolE4Te', 62); // -> 1.234e+50
parse('5bc', 13); // -> 1000
parse('112', 5); // -> 32
(static) radix(number, base) → {string}
Parameters:
Name |
Type |
Description |
number |
number
|
A typical JavaScript unsigned number. |
base |
number
|
The new base you want. Must be between 2 and 62. |
- Source:
Returns:
-
Type
-
string
Example
radix(1.234e50, 62); // -> 'NK7qkfsZSrqYB7KGPtq9zoolE4Te'
radix(1000, 13); // -> '5bc'
radix(32, 5); // -. '112'