url-match
url-match is a pattern matching for urls paths and query parameters based on the backbone router and the plugin backbone-query-parameters
install
npm install url-match
or
put this line in the dependencies section of your package.json
:
"url-match": "0.1.0"
then run:
npm install
require
var urlMatch = ;
match urls
make pattern from string
var pattern = urlPattern;
match pattern against url
match returns the extracted parameters or null
if there was no match:
pattern; // => nullpattern; // => [{id: '5'}, {}]pattern; // => [{id: '5'}, {a: "b", c: "d"}]