We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 394eebf commit dcb6cb6Copy full SHA for dcb6cb6
src/lib/isBtcAddress.js
@@ -1,14 +1,9 @@
1
import assertString from './util/assertString';
2
3
-// supports Bech32 addresses
4
const bech32 = /^(bc1)[a-z0-9]{25,39}$/;
5
const base58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;
6
7
export default function isBtcAddress(str) {
8
assertString(str);
9
- // check for bech32
10
- if (str.startsWith('bc1')) {
11
- return bech32.test(str);
12
- }
13
- return base58.test(str);
+ return bech32.test(str) || base58.test(str);
14
}
0 commit comments