checkHost.js 500 B

1234567891011121314151617181920
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = checkHost;
  6. function isRegExp(obj) {
  7. return Object.prototype.toString.call(obj) === '[object RegExp]';
  8. }
  9. function checkHost(host, matches) {
  10. for (var i = 0; i < matches.length; i++) {
  11. var match = matches[i];
  12. if (host === match || isRegExp(match) && match.test(host)) {
  13. return true;
  14. }
  15. }
  16. return false;
  17. }
  18. module.exports = exports.default;
  19. module.exports.default = exports.default;