Updated examples for partial, partialRight

This commit is contained in:
Angelos Chalaris
2018-02-04 17:00:20 +02:00
parent c0735d56c0
commit a8085d4259
2 changed files with 2 additions and 6 deletions

View File

@ -9,9 +9,7 @@ const partial = (fn, ...partials) => (...args) => fn(...partials, ...args);
``` ```
```js ```js
function greet(greeting, name) { const greet = (greeting, name) => greeting + ' ' + name + '!';
return greeting + ' ' + name + '!';
}
const greetHello = partial(greet, 'Hello'); const greetHello = partial(greet, 'Hello');
greetHello('John'); // 'Hello John!' greetHello('John'); // 'Hello John!'
``` ```

View File

@ -9,9 +9,7 @@ const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials);
``` ```
```js ```js
function greet(greeting, name) { const greet = (greeting, name) => greeting + ' ' + name + '!';
return greeting + ' ' + name + '!';
}
const greetJohn = partialRight(greet, 'John'); const greetJohn = partialRight(greet, 'John');
greetJohn('Hello'); // 'Hello John!' greetJohn('Hello'); // 'Hello John!'
``` ```