UNPKG

maycur-business

Version:

maycur business react components of web

20 lines (17 loc) 721 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = isurl; // Copyright 2015-2018 FormBucket LLC // ISURL returns true when the value matches the regex for a uniform resource locator. function isurl(str) { // credit: http://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-an-url var pattern = new RegExp("^(https?:\\/\\/)?" + // protocol "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|" + // domain name "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string "(\\#[-a-z\\d_]*)?$", "i"); // fragment locator return pattern.test(str); }