Fixing the babel, scrypt, and base58 issues

This commit is contained in:
Brian Whitney 2018-10-21 21:10:49 -04:00
parent 5155d0ed56
commit f4de4de8c1
5 changed files with 40 additions and 3 deletions

View file

@ -71,6 +71,11 @@ class FromBase58 extends Operation {
if (input.length === 0) return [];
let zeroPrefix = 0;
for (let i = 0; i < input.length && input[i] === alphabet[0]; i++) {
zeroPrefix++;
}
[].forEach.call(input, function(c, charIndex) {
const index = alphabet.indexOf(c);
@ -98,6 +103,11 @@ class FromBase58 extends Operation {
}
});
while (zeroPrefix > 0) {
result.push(0);
zeroPrefix--;
}
return result.reverse();
}