How do you validate a bitcoin address using bitcoinjs library in javascript? How would one validate a bitcoin address using the bitcoinjs library? Or is there another way to do this via javascript?
If you call

bitcoin.address.toOutputScript(address, bitcoin.networks.bitcoin)


It will throw an error if the address cannot be parsed as P2SH or P2PKH, or if the checksum is not valid. Replace the second argument with bitcoin.networks.testnet for testnet.