Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 977 Bytes

File metadata and controls

31 lines (23 loc) · 977 Bytes

Partial Application with Named Parameters Build Status

screenshot

Usage

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);
});

License

MIT © Herman Starikov