From 92db5d759569944e494c4f87e102b6e02b4db782 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Thu, 28 Dec 2017 08:32:00 +0000 Subject: [PATCH] Travis build: 392 --- README.md | 52 ++++++++++++++++++++--------------------- snippets/call.md | 16 ++++++------- snippets/collectInto.md | 12 +++++----- snippets/flip.md | 16 ++++++------- snippets/spreadOver.md | 8 +++---- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 11a115f74..d0c9d0248 100644 --- a/README.md +++ b/README.md @@ -186,17 +186,17 @@ 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); ``` ```js -Promise.resolve([1, 2, 3]) - .then(call('map', x => 2 * x)) - .then(console.log); //[ 2, 4, 6 ] -const map = call.bind(null, 'map'); -Promise.resolve([1, 2, 3]) - .then(map(x => 2 * x)) - .then(console.log); //[ 2, 4, 6 ] +Promise.resolve([1, 2, 3]) + .then(call('map', x => 2 * x)) + .then(console.log); //[ 2, 4, 6 ] +const map = call.bind(null, 'map'); +Promise.resolve([1, 2, 3]) + .then(map(x => 2 * x)) + .then(console.log); //[ 2, 4, 6 ] ``` [⬆ back to top](#table-of-contents) @@ -208,15 +208,15 @@ Changes a function that accepts an array into a variadic function. Given a function, return a closure that collects all inputs into an array-accepting function. ```js -const collectInto = fn => (...args) => fn(args); +const collectInto = fn => (...args) => fn(args); ``` ```js -const Pall = collectInto(Promise.all.bind(Promise)); -let p1 = Promise.resolve(1); -let p2 = Promise.resolve(2); -let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); -Pall(p1, p2, p3).then(console.log); +const Pall = collectInto(Promise.all.bind(Promise)); +let p1 = Promise.resolve(1); +let p2 = Promise.resolve(2); +let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); +Pall(p1, p2, p3).then(console.log); ``` [⬆ back to top](#table-of-contents) @@ -228,17 +228,17 @@ Flip takes a function as an argument, then makes the first argument the last Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest. ```js -const flip = fn => (...args) => fn(args.pop(), ...args); +const flip = fn => (...args) => fn(args.pop(), ...args); ``` ```js -let a = { name: 'John Smith' }; -let b = {}; -const mergeFrom = flip(Object.assign); -let mergePerson = mergeFrom.bind(null, a); -mergePerson(b); // == b -b = {}; -Object.assign(b, a); // == b +let a = { name: 'John Smith' }; +let b = {}; +const mergeFrom = flip(Object.assign); +let mergePerson = mergeFrom.bind(null, a); +mergePerson(b); // == b +b = {}; +Object.assign(b, a); // == b ``` [⬆ back to top](#table-of-contents) @@ -293,13 +293,13 @@ Takes a variadic function and returns a closure that accepts an array of argumen Use closures and the spread operator (`...`) to map the array of arguments to the inputs of the function. ```js -const spreadOver = fn => argsArr => fn(...argsArr); +const spreadOver = fn => argsArr => fn(...argsArr); ``` ```js -const arrayMax = spreadOver(Math.max); -arrayMax([1, 2, 3]); // 3 -arrayMax([1, 2, 4]); // 4 +const arrayMax = spreadOver(Math.max); +arrayMax([1, 2, 3]); // 3 +arrayMax([1, 2, 4]); // 4 ``` [⬆ back to top](#table-of-contents) diff --git a/snippets/call.md b/snippets/call.md index dd42d9013..22cba9afd 100644 --- a/snippets/call.md +++ b/snippets/call.md @@ -5,15 +5,15 @@ 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); ``` ```js -Promise.resolve([1, 2, 3]) - .then(call('map', x => 2 * x)) - .then(console.log); //[ 2, 4, 6 ] -const map = call.bind(null, 'map'); -Promise.resolve([1, 2, 3]) - .then(map(x => 2 * x)) - .then(console.log); //[ 2, 4, 6 ] +Promise.resolve([1, 2, 3]) + .then(call('map', x => 2 * x)) + .then(console.log); //[ 2, 4, 6 ] +const map = call.bind(null, 'map'); +Promise.resolve([1, 2, 3]) + .then(map(x => 2 * x)) + .then(console.log); //[ 2, 4, 6 ] ``` diff --git a/snippets/collectInto.md b/snippets/collectInto.md index 57c5f4be0..3da1173bd 100644 --- a/snippets/collectInto.md +++ b/snippets/collectInto.md @@ -5,13 +5,13 @@ Changes a function that accepts an array into a variadic function. Given a function, return a closure that collects all inputs into an array-accepting function. ```js -const collectInto = fn => (...args) => fn(args); +const collectInto = fn => (...args) => fn(args); ``` ```js -const Pall = collectInto(Promise.all.bind(Promise)); -let p1 = Promise.resolve(1); -let p2 = Promise.resolve(2); -let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); -Pall(p1, p2, p3).then(console.log); +const Pall = collectInto(Promise.all.bind(Promise)); +let p1 = Promise.resolve(1); +let p2 = Promise.resolve(2); +let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); +Pall(p1, p2, p3).then(console.log); ``` diff --git a/snippets/flip.md b/snippets/flip.md index dd6117986..3ab12dd78 100644 --- a/snippets/flip.md +++ b/snippets/flip.md @@ -5,15 +5,15 @@ Flip takes a function as an argument, then makes the first argument the last Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest. ```js -const flip = fn => (...args) => fn(args.pop(), ...args); +const flip = fn => (...args) => fn(args.pop(), ...args); ``` ```js -let a = { name: 'John Smith' }; -let b = {}; -const mergeFrom = flip(Object.assign); -let mergePerson = mergeFrom.bind(null, a); -mergePerson(b); // == b -b = {}; -Object.assign(b, a); // == b +let a = { name: 'John Smith' }; +let b = {}; +const mergeFrom = flip(Object.assign); +let mergePerson = mergeFrom.bind(null, a); +mergePerson(b); // == b +b = {}; +Object.assign(b, a); // == b ``` diff --git a/snippets/spreadOver.md b/snippets/spreadOver.md index 524ab676d..2412b6b18 100644 --- a/snippets/spreadOver.md +++ b/snippets/spreadOver.md @@ -5,11 +5,11 @@ Takes a variadic function and returns a closure that accepts an array of argumen Use closures and the spread operator (`...`) to map the array of arguments to the inputs of the function. ```js -const spreadOver = fn => argsArr => fn(...argsArr); +const spreadOver = fn => argsArr => fn(...argsArr); ``` ```js -const arrayMax = spreadOver(Math.max); -arrayMax([1, 2, 3]); // 3 -arrayMax([1, 2, 4]); // 4 +const arrayMax = spreadOver(Math.max); +arrayMax([1, 2, 3]); // 3 +arrayMax([1, 2, 4]); // 4 ```