diff --git a/README.md b/README.md index cc5c01a4f..a18303d29 100644 --- a/README.md +++ b/README.md @@ -4011,9 +4011,7 @@ const partial = (fn, ...partials) => (...args) => fn(...partials, ...args); Examples ```js -function greet(greeting, name) { - return greeting + ' ' + name + '!'; -} +const greet = (greeting, name) => greeting + ' ' + name + '!'; const greetHello = partial(greet, 'Hello'); greetHello('John'); // 'Hello John!' ``` @@ -4037,9 +4035,7 @@ const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials); Examples ```js -function greet(greeting, name) { - return greeting + ' ' + name + '!'; -} +const greet = (greeting, name) => greeting + ' ' + name + '!'; const greetJohn = partialRight(greet, 'John'); greetJohn('Hello'); // 'Hello John!' ``` diff --git a/docs/index.html b/docs/index.html index 627dacfb2..da348c4a1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -914,15 +914,11 @@ console.log< }; document.body.addEventListener('click', once(startApp)); // only runs `startApp` once upon click

partial

Creates a function that invokes fn with partials prepended to the arguments it receives.

Use the spread operator (...) to prepend partials to the list of arguments of fn.

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

partialRight

Creates a function that invokes fn with partials appended to the arguments it receives.

Use the spread operator (...) to append partials to the list of arguments of fn.

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

runPromisesInSeries

Runs an array of promises in series.

Use Array.reduce() to create a promise chain, where each promise returns the next promise when resolved.

const runPromisesInSeries = ps => ps.reduce((p, next) => p.then(next), Promise.resolve());