Simplify the error check

This commit is contained in:
Jackson Mills
2022-05-26 16:55:59 -07:00
parent 83db1abe4f
commit 2e99cf6449

View File

@@ -94,10 +94,7 @@ async function fundWallet(
if (
options?.faucetHost != null &&
(options.faucetHost.startsWith('ws://') ||
options.faucetHost.startsWith('wss://') ||
options.faucetHost.startsWith('http://') ||
options.faucetHost.startsWith('https://'))
/^(http|https|ws|wss):\/\//.test(options.faucetHost)
) {
throw new XRPLFaucetError(
`Invalid format for faucetHost. Should not include ws(s)/http(s) prefix. Received '${options.faucetHost}'.`,