Turn page.js route strings into real urls
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.npmignore
.travis.yml
example.js
index.js
package-lock.json
package.json
path-parser.js
readme.md
test.js

readme.md

Build Status

For those times when you want to programmatically generate a link to a page.js route.

Usage

var buildPath = require('./')

buildPath('/wat/:huh/yeah', { huh: 'go figure' }) // => '/wat/go%20figure/yeah'

Or parse a path once for more efficient url construction later:

var parsedPath = buildPath('/page/:id')

buildPath(parsedPath, { id: 13 }) // => '/page/13'

buildPath(parsedPath, { id: 1337 }) // => '/page/1337'