Files
copilot-toolbox-sdfdsfds/node_modules/@ant-design/pro-utils/lib/isUrl/index.js
2026-01-16 01:51:36 +00:00

23 lines
429 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isUrl = void 0;
/**
* 判断是不是一个 url
* @param {string|undefined} path
* @returns boolean
*/
var isUrl = exports.isUrl = function isUrl(path) {
if (!path) return false;
if (!path.startsWith('http')) {
return false;
}
try {
var url = new URL(path);
return !!url;
} catch (error) {
return false;
}
};