Skip to content

Commit

Permalink
fix(encoding): base58 decoding (#2982)
Browse files Browse the repository at this point in the history
  • Loading branch information
kratico authored Dec 13, 2022
1 parent 01ec142 commit 01696ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion encoding/base58.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export function decode(b58: string): Uint8Array {
length = i;
});

const validOutput = output.filter((item) => item ?? false);
const validOutput = output.filter((item) => item !== undefined);

if (ones > 0) {
const onesResult = Array.from({ length: ones }).fill(0, 0, ones);
Expand Down
1 change: 1 addition & 0 deletions encoding/base58_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const testSetString = [
["foobar", "t1Zv2yaZ"],
["Hello World!", "2NEpo7TZRRrLZSi2U"],
[new Uint8Array([0, 0, 0, 40, 127, 180, 205]), "111233QC4"],
[new Uint8Array([10, 0, 10]), "4MpV"],
];

const testSetBinary = testSetString.map(([data, b58]) => {
Expand Down

0 comments on commit 01696ce

Please sign in to comment.