@mcma/core 0.13.27 → 0.13.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/utils.js +7 -8
- package/package.json +1 -1
package/dist/lib/utils.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Utils = void 0;
|
|
4
4
|
const mcma_exception_1 = require("./mcma-exception");
|
|
5
|
-
const validUrl = new RegExp("^(https?:\\/\\/)?" + // protocol
|
|
6
|
-
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
|
|
7
|
-
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
|
|
8
|
-
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
|
|
9
|
-
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
|
|
10
|
-
"(\\#[-a-z\\d_]*)?$", "i" // fragment locator
|
|
11
|
-
);
|
|
12
5
|
function isValidUrl(url) {
|
|
13
|
-
|
|
6
|
+
try {
|
|
7
|
+
new URL(url);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
14
13
|
}
|
|
15
14
|
function getTypeName(type) {
|
|
16
15
|
if (typeof type === "function") {
|