@remusao/url-match-patterns
v1.2.0
Published
Test URLs against match patterns
Downloads
4,115
Readme
@remusao/url-match-patterns
Test URLs against match patterns, as defined by Google and Mozilla.
import match, { Pattern } from '@remusao/url-match-patterns';
// check that a url matches
match('*://*/*', 'https://www.example.com'); // true
// pre-compile pattern for faster performance
const pattern = new Pattern('*://*/*');
pattern.match('https://www.example.com'); // true
// More examples
match('<all_urls>', 'https://www.example.com'); // true
match('https://example.com/*', 'https://www.example.com'); // false
match('https://*.example.com/*', 'https://www.example.com'); // true