earls-function-mapper

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i earls-function-mapper

Weekly Downloads

2

Version

0.0.1

License

none

Last publish

Collaborators

  • enome