deligare

1.1.2 • Public • Published

deligare

Build Status Coverage Status

A most flexible and powerful function parameter delegation utility.

How does it work?

As easy as this:

var del = require('deligare');
var add = function (a, b) {
    return a + b;
};
var sub = function (a, b) {
    return a - b;
};
var addOne = del(add, [1]);
var subTwo = del(sub, [undefined, 2]);

addOne(5); // -> 6 (equivalent to "add(1, 5)")
subTwo(5); // -> 3 (equivalent to "sub(5, 2)")

How do I get it?

You can use npm install it:

npm install deligare

So it is a nodejs module. How can use it in a browser based app?

Don't worry. The package provides a bundled (and minified) standalone JS file which can be included, e.g.:

<script src="{path}/dist/deligare.min.js"></script>

Alternatively you can use tools like browserify to include it in your project. The lib has no further dependencies and should run fine in any browser environment.

Package Sidebar

Install

npm i deligare

Weekly Downloads

2

Version

1.1.2

License

MIT

Last publish

Collaborators

  • michbuett