url-pattern v0.8 Release Notes
-
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 tonew UrlPattern
to 0️⃣ 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