We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parsePath('https://www.baidu.com/123?a=456')
看了一下实现
try { var parsed = new URL(url); output.protocols = protocols(parsed); output.protocol = output.protocols[0]; output.port = parsed.port; output.resource = parsed.hostname; output.host = parsed.host; output.user = parsed.username || ""; output.password = parsed.password || ""; output.pathname = parsed.pathname; output.hash = parsed.hash.slice(1); output.search = parsed.search.slice(1); output.href = parsed.href; output.query = Object.fromEntries(parsed.searchParams); } catch (e) { // TODO Maybe check if it is a valid local file path // In any case, these will be parsed by higher // level parsers such as parse-url, git-url-parse, git-up output.protocols = ["file"]; output.protocol = output.protocols[0]; output.port = ""; output.resource = ""; output.user = ""; output.pathname = ""; output.hash = ""; output.search = ""; output.href = url; output.query = {}; output.parse_failed = true; }
使用 try 中使用的是 new URL(), 在微信小程序中 new 这个实例会出现报错走到 catch,还是低版本 parse-path 的会更通用
The text was updated successfully, but these errors were encountered:
No branches or pull requests
parsePath('https://www.baidu.com/123?a=456')
看了一下实现
try {
var parsed = new URL(url);
output.protocols = protocols(parsed);
output.protocol = output.protocols[0];
output.port = parsed.port;
output.resource = parsed.hostname;
output.host = parsed.host;
output.user = parsed.username || "";
output.password = parsed.password || "";
output.pathname = parsed.pathname;
output.hash = parsed.hash.slice(1);
output.search = parsed.search.slice(1);
output.href = parsed.href;
output.query = Object.fromEntries(parsed.searchParams);
} catch (e) {
// TODO Maybe check if it is a valid local file path
// In any case, these will be parsed by higher
// level parsers such as parse-url, git-url-parse, git-up
output.protocols = ["file"];
output.protocol = output.protocols[0];
output.port = "";
output.resource = "";
output.user = "";
output.pathname = "";
output.hash = "";
output.search = "";
output.href = url;
output.query = {};
output.parse_failed = true;
}
使用 try 中使用的是 new URL(), 在微信小程序中 new 这个实例会出现报错走到 catch,还是低版本 parse-path 的会更通用
The text was updated successfully, but these errors were encountered: