Skip to content

Commit

Permalink
add multipattern feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Openyshev committed Nov 6, 2019
1 parent 3023be7 commit 497448c
Show file tree
Hide file tree
Showing 7 changed files with 598 additions and 148 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ console.log(route.match('/products')); // => {}
console.log(route.match('/products/321')); // => { id : '321' }
```

* With multiple patterns:

```javascript
var route = Susanin.Route({
pattern: [
{ name: 'products', test: '/products(/<id>)' },
{ name: 'productsWithSize', test: '/products/<id>/<size>' }
]
}));

console.log(route.match('/products/321')); // => { id: '321' }
console.log(route.match('/products/321/xxl')); // => { id: '321', size: 'xxl' }
```

* With a default value of param:

```javascript
Expand Down
Loading

0 comments on commit 497448c

Please sign in to comment.