This commit is contained in:
Angelos Chalaris
2017-12-27 11:02:46 +02:00
parent 0d9b02a3cb
commit b74eb9d9bd
45 changed files with 89 additions and 91 deletions

View File

@ -5,7 +5,7 @@ Given a key and a set of arguments, call them when given a context. Primarily us
Use a closure to call a stored key with stored arguments.
```js
const call = ( key, ...args ) => context => context[ key ]( ...args );
const call = (key, ...args) => context => context[ key ](...args);
/*
Promise.resolve( [ 1, 2, 3 ] ).then( call('map', x => 2 * x ) ).then( console.log ) //[ 2, 4, 6 ]
const map = call.bind(null, 'map')