ethers.js
ethers.js copied to clipboard
feat: improve utility of isAddress
Improves the utility of isAddress:
- allows it to check any type (
unknown), instead of restricting it tostring - returns
string | false, so that anunknowntype passed in can then be narrowed to astringwithout coercion
This will not break usages in conditionals, as string is truthy, so string | false can still be used eg in if (isAddress(addr)).
This will break usages where true/false are explicitly checked, such as isAddress(addr) === true/!== false.