Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Custom mapper for earls using functions
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
Makefile
README.markdown
package.json
spec.js
src.js

README.markdown

Earls Function Mapper

Custom mapper for earls.

How do I install it?

npm install earls-function-mapper

How do I use it?

var mapper = require('earls-function-mapper').mapper;
var url = require('earls-function-mapper').url;

earls.register('f', mapper);

earls.f( function(){

  url('products', '/products', function(){

    url('show', '/show/:productid');

  });

});

The url property is optional if the name and url match and if you don't need arguments in your url. Like products in the example above.

var url = require('earls-function-mapper').url;

earls.f( function(){

  url('products', function(){

    url('show', '/show/:productid');

  });

});

This mapper works well with Coffee-Script to create concise maps.

url 'root', '/', ->
  url 'products', ->
    url 'new'
    url 'create'
    url 'edit'
    url 'update', '/update/:productid'
    url 'show', '/show/:productid'
    url 'destroy'

Run tests

Tests use mocha and should.

make unittests
Something went wrong with that request. Please try again.