urlPattern.test(input[, baseURL])
- 
baseURL<string> | <undefined> 基本 URL 字符串¥ baseURL<string> | <undefined> A base URL string
输入可以是字符串或提供各个 URL 部分的对象。对象成员可以是 protocol、username、password、hostname、port、pathname、search、hash 或 baseURL 中的任意一个。
¥Input can be a string or an object providing the individual URL parts. The
object members can be any of protocol, username, password, hostname,
port, pathname, search, hash or baseURL.
如果未指定 baseURL,则默认为 undefined。
¥If baseURL is not specified, it will default to undefined.
返回一个布尔值,指示输入是否与当前模式匹配。
¥Returns a boolean indicating if the input matches the current pattern.
const myPattern = new URLPattern('https://nodejs.cn/docs/latest/api/*.html');
console.log(myPattern.test('https://nodejs.cn/docs/latest/api/dns.html'));
// Prints: true