isBtcAddress.js 567 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isBtcAddress;
  6. var _assertString = _interopRequireDefault(require("./util/assertString"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. var bech32 = /^(bc1)[a-z0-9]{25,39}$/;
  9. var base58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;
  10. function isBtcAddress(str) {
  11. (0, _assertString.default)(str);
  12. return bech32.test(str) || base58.test(str);
  13. }
  14. module.exports = exports.default;
  15. module.exports.default = exports.default;