Skip to content

AjayMT/mapit.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mapit

Are you tired of doing this?

var app = express();

app.set('abc', 'xyz');
app.set('foo', true);
app.set('bar', {});

With mapit, you can do this:

var app = express();
var mapit = require('mapit');

app.mapit(app.set, {
  'abc': 'xyz',
  'foo': true,
  'bar': {}
});

It works with anything:

app.mapit(app.get, {
  '/': function (req, res) {
    res.send('hello');
  },
  '/hello': function (req, res) {
    res.send('world');
  }
});

You can even use it like this:

// It doesn't have to be app.mapit
mapit(app.set, {
  'abc': 'xyz'
}, app);

Note: express was just an example. mapit works everywhere.

Installation

node

Install with npm:

$ npm install --save mapit

browser

bower:

$ bower install --save mapit

Or just put mapit.js in a script tag.

License

MIT License. See ./LICENSE for details.

About

Add some sugar to a commonly used pattern

Resources

License

Stars

Watchers

Forks

Packages

No packages published