From d7f6d6a17cbf59564c8dc4801682df09035bca7a Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 22 Dec 2017 19:01:56 +0000 Subject: [PATCH] Travis build: 147 --- README.md | 47 ++++++++++++++++++++++------------------------- docs/index.html | 33 +++++++++++++++------------------ 2 files changed, 37 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 99ac7f01a..19192f127 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ ### Adapter * [`collectInto`](#collectinto) +* [`flip`](#flip) * [`promisify`](#promisify) * [`spreadOver`](#spreadover) @@ -163,9 +164,6 @@ * [`UUIDGenerator`](#uuidgenerator) * [`validateNumber`](#validatenumber) -### _Uncategorized_ -* [`flip`](#flip) - ## Adapter ### collectInto @@ -187,6 +185,27 @@ Pall(p1, p2, p3).then(console.log) [⬆ back to top](#table-of-contents) +### flip + +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) +/* +let a = {name: 'John Smith'} +let b = {} +const mergeFrom = flip(Object.assign) +let mergePerson = mergeFrom.bind(a) +mergePerson(b) // == b +b = {} +Object.assign(b, a) // == b +*/ +``` + +[⬆ back to top](#table-of-contents) + ### promisify Converts an asynchronous function to return a promise. @@ -2218,28 +2237,6 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == // validateNumber('10') -> true ``` -[⬆ back to top](#table-of-contents) -## _Uncategorized_ - -### flip - -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) -/* -let a = {name: 'John Smith'} -let b = {} -const mergeFrom = flip(Object.assign) -let mergePerson = mergeFrom.bind(a) -mergePerson(b) // == b -b = {} -Object.assign(b, a) // == b -*/ -``` - [⬆ back to top](#table-of-contents) ## Credits diff --git a/docs/index.html b/docs/index.html index dcfb4febc..f4818317f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,6 +43,7 @@

Adapter

collectInto +flip promisify spreadOver @@ -191,9 +192,6 @@ UUIDGenerator validateNumber -

Uncategorized -

flip -
 

Adapter

collectInto

Changes a function that accepts an array into a variadic function.

@@ -207,6 +205,20 @@ let p3 = new Promise((resolve) => setTimeout(resolve,2000,3)) Pall(p1, p2, p3).then(console.log) */ +

flip

+

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.

+
const flip = fn => (...args) => fn(args.pop(), ...args)
+/*
+let a = {name: 'John Smith'}
+let b = {}
+const mergeFrom = flip(Object.assign)
+let mergePerson = mergeFrom.bind(a)
+mergePerson(b) // == b
+b = {}
+Object.assign(b, a) // == b
+*/
+

promisify

Converts an asynchronous function to return a promise.

Use currying to return a function returning a Promise that calls the original function. @@ -1349,21 +1361,6 @@ Use Number() to check if the coercion holds.

const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n;
 // validateNumber('10') -> true
 
-

Uncategorized

-

flip

-

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.

-
const flip = fn => (...args) => fn(args.pop(), ...args)
-/*
-let a = {name: 'John Smith'}
-let b = {}
-const mergeFrom = flip(Object.assign)
-let mergePerson = mergeFrom.bind(a)
-mergePerson(b) // == b
-b = {}
-Object.assign(b, a) // == b
-*/
-