All Versions
7
Latest Version
Avg Release Cycle
56 days
Latest Release
1609 days ago

Changelog History

  • v1.0.1

    December 29, 2015
  • v0.10.2

    September 09, 2015
  • v0.10.1

    September 09, 2015
  • v0.10.0

    August 19, 2015
  • v0.9

    May 18, 2015

    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](bower.json) and registered with bower as url-pattern.

  • v0.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 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
    
  • v0.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');