Partial Application with Named Parameters
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