rlookup

0.2.1 • Public • Published

rlookup

A route lookup built on top of Houkou.

Build Status

Usage

var rlookup = new RLookup();
 
rlookup.add('/some-:path');
rlookup.add({
  name: '/some-:path/:more',
  requirements: {
    'more': '[0-9]+' // only match numbers in more
  }
});
 
rlookup.match('/some-thing/123');
// =>
// { pattern: '/some-:path/:more',
//   params: { path: 'thing', more: '123' } }

See Houkou for more info on routes and the example for more advanced stuff like setting up requirements for routes' parameters.

MIT license.

Package Sidebar

Install

npm i rlookup

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • dariocravero