npm

Does your artifact manager get in the way? Join us on Oct. 8 at 10am PT, to discuss how npm can help.Sign up »

url-match-patterns

0.2.0 • Public • Published

url-match-patterns

A node module for testing URLs against match patterns, as defined by Google and Mozilla.

Example

import match from 'url-match-patterns';
 
// check that a url matches
match('*://*/', 'https://www.example.com'); // true
 
// or build a reusable function
const matches = match('*://*/');
matches('https://www.example.com'); // true
 

API

match(pattern, url) -> Boolean

Compares a pattern against a URL. Returns true if the pattern matches or false if it doesn't. Will throw an AssertionError if your pattern is invalid.

match(pattern) -> Function

Create a reusable match function for a pattern. This will be faster since it only has to initialize once. Will throw an AssertionError if your pattern is invalid.

install

npm i url-match-patterns

Downloadsweekly downloads

132

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability