MatrixAI / js-id

ID generation for JavaScript & TypeScript Applications
https://polykey.com
Apache License 2.0
10 stars 1 forks source link

Patch for `fromMultibase` syntax error on plain string inputs #14

Closed emmacasolin closed 2 years ago

emmacasolin commented 2 years ago

Description

The fromMultibase() utility was throwing a Syntax Error on plain string inputs, when it should instead have been returning undefined. The line this was coming from, codec.decode(), has now been warpped in a try-catch block in order to return undefined on this error, as is the expected behaviour.

Tasks

  1. [x] Add a catch handler on codec.decode() for Syntax Errors
  2. [x] Update utils tests to cover this case

Final checklist