beaulac/node-base62x

is that correct?

Closed this issue · 2 comments

As following code does:

console.log(nodeBase62x.decode(nodeBase62x.encode("")));
console.log(nodeBase62x.decode(nodeBase62x.encode(Buffer.from([]))));
console.log(nodeBase62x.decode(nodeBase62x.encode(Buffer.from([0]))));
console.log(nodeBase62x.decode(nodeBase62x.encode(Buffer.from([0, 0]))));
console.log(nodeBase62x.decode(nodeBase62x.encode(Buffer.from([0, 0, 0]))));

Encoding/Decoding result of empty buffer and empty string is not the same?

Great catch -- you're right, an empty buffer should encode to the same as an empty string. This should be fixed in the latest release (1.1.0). Thanks!

well done, @beaulac