Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Picking and matching module for froute
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.jshintrc
.travis.yml
Gruntfile.js
README.md
froute-picker-spec.js
froute-picker.js
package.json

README.md

froute-picker Build Status npm version Dependency Status

froute-picker is a "picking" and "matching" module used by froute. It picks parameters from url templates matches urls to the templates while assigning parameter values.

Getting started

Using npm

npm install froute-picker
var picker = require("froute-picker");

Example

Picking parameters from a url template and matching a url to the template

var template = "/apple/{type}/size/{size}",
    picked = picker.pick(template),
    matchUrl = picker.match("/apple/gala/size/large");
    result = matchUrl(picked);

expect(result).not.toBeNull();
expect(result.type).toEqual("gala");
expect(result.size).toEqual("large");
Something went wrong with that request. Please try again.