Updated examples for partial, partialRight
This commit is contained in:
@ -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!'
|
||||||
```
|
```
|
||||||
|
|||||||
@ -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!'
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user