mapit

0.0.21 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i mapit

Weekly Downloads

2

Version

0.0.21

License

MIT

Last publish

Collaborators

  • ajaymt