Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "wayfarer", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A simple router built for minimalism and speed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,12 +15,6 @@ # wayfarer | ||
```js | ||
/** | ||
* Initialize wayfarer. | ||
*/ | ||
var wayfarer = require('wayfarer'); | ||
var router = wayfarer(); | ||
/** | ||
* Register routes. | ||
*/ | ||
// Register routes. | ||
@@ -34,5 +28,3 @@ router | ||
/** | ||
* Match a route. | ||
*/ | ||
// Match a route. | ||
@@ -44,9 +36,7 @@ router.match('/tobi') | ||
## API | ||
#### .path() | ||
#### .path(path, cb) | ||
Register a new path. Partial paths are supported through the /: operator. | ||
Wayfarer uses a trie to match routes, so the order in which routes are | ||
registered does not matter. | ||
```js | ||
// Register a new path. Takes a {String} pathName that calls a | ||
// {Function} callback. Partial paths are supported through the /: operator. | ||
// Wayfarer uses a trie to match routes, so the order in which routes are | ||
// registered does not matter. | ||
router.path('/', function() {console.log('do stuff')}); | ||
@@ -56,7 +46,6 @@ router.path('/:user', function() {console.log('do user stuff')}); | ||
#### .default() | ||
#### .default(defaultPath) | ||
Sets a default path to match. This is particularly | ||
useful for setting 404 pages. | ||
```js | ||
// Set a {String} pathName as the default path to match. This is particularly | ||
// useful for setting 404 pages. | ||
router.default('/404'); | ||
@@ -66,7 +55,6 @@ router.path('/404', function() {console.log('sunglasses not found')}); | ||
#### .match() | ||
#### .match(path) | ||
Match a path against the saved paths in the router. If a match is | ||
found the registered callback will be executed. | ||
```js | ||
// Match a {String} path against the saved paths in the router. If a match is | ||
// found the registered callback will be executed. | ||
router.match('/tobi'); | ||
@@ -73,0 +61,0 @@ // => 'do user stuff' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6098
69