mirror of
https://github.com/jimeh/node-base58.git
synced 2026-02-19 07:36:40 +00:00
Give encode/decode functions more descriptive names
- `encode()`: Renamed to `int_to_base58()`. - `decode()`: Renamed to `base58_to_int()`. - Maintain aliases of old function names for backwards compatibility.
This commit is contained in:
@@ -31,7 +31,7 @@ function assertBase58Character(character) {
|
||||
}
|
||||
}
|
||||
|
||||
exports.encode = function(num) {
|
||||
exports.int_to_base58 = exports.encode = function(num) {
|
||||
let str = "";
|
||||
let modulus;
|
||||
|
||||
@@ -48,7 +48,7 @@ exports.encode = function(num) {
|
||||
return alphabet[num] + str;
|
||||
};
|
||||
|
||||
exports.decode = function(str) {
|
||||
exports.base58_to_int = exports.decode = function(str) {
|
||||
assertString(str);
|
||||
|
||||
return [...str].reverse().reduce((num, character, index) => {
|
||||
|
||||
Reference in New Issue
Block a user