Partial Application with Named Parameters ![Build Status](https://camo.githubusercontent.com/08fd3145d31554bd8f75339a6535b44d75ab177900f196306a5cc9c698db5e2f/68747470733a2f2f7472617669732d63692e6f72672f4865726d616e79612f7061727469616c2d6170706c69636174696f6e2d776974682d6e616d65642d706172616d65746572732e7376673f6272616e63683d6d6173746572)
First have a function, that destructs its first and only parameter. This module will make you able to partially apply named parameters for that function. Take a look at tests to for details.
import test from 'ava';
import bindable from './';
test('calculate sum', t => {
const reduce = bindable(function ({reducer, initialValue, array}) {
return array.reduce(reducer, initialValue);
});
const reduceFromZero = reduce({initialValue: 0});
const array = [1, 2, 3];
t.is(reduceFromZero({
reducer: (x, y) => x + y,
array
}), 6);
});
MIT © Herman Starikov