Skip to content

Latest commit

 

History

History
84 lines (59 loc) · 2.38 KB

CHANGELOG.md

File metadata and controls

84 lines (59 loc) · 2.38 KB

changelog

0.7

instead of

var urlPattern = require('url-pattern');
var pattern = urlPattern.newPattern('/example');

now use

var Pattern = require('url-pattern');
var pattern = new Pattern('/example');

0.8

single wildcard matches are now saved directly as a string on the _ property and not as an array with 1 element:

> var pattern = new Pattern('/api/*');
> pattern.match('/api/users/5')
{_: 'users/5'}

if named segments occur more than once the results are collected in an array.

parsing of named segment names (:foo) and named segment values now stops at the next non-alphanumeric character. it is no longer needed to declare separators other than / explicitely. it was previously necessary to use the second argument to new UrlPattern to override the default separator /. the second argument is now ignored. mixing of separators is now possible (/ and . in this example):

> var pattern = new UrlPattern('/v:major(.:minor)/*');

> pattern.match('/v1.2/');
{major: '1', minor: '2', _: ''}

> pattern.match('/v2/users');
{major: '2', _: 'users'}

> pattern.match('/v/');
null

0.9

named segments now also match -, _, and %.

\\ can now be used to escape characters.

made all special chars and charsets used in parsing configurable.

added bower.json and registered with bower as url-pattern.

0.10

issue 15:
named segments now also match the ~ character.
this will break your code if you relied on the fact that named segments stop matching at ~ !
you can customize the parsing to go back to the old behaviour

the way the parser is customized has changed.
this will break your code if you customized the parser !
read me
updating your code is very easy.

issue 14:
read me
non breaking

issue 11:
read me
non breaking

messages on errors thrown on invalid patterns have changed slightly.