Travis build: 147
This commit is contained in:
47
README.md
47
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
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
|
||||
<h3>Adapter
|
||||
</h3><a class="sublink-1" href="#collectinto">collectInto</a>
|
||||
<a class="sublink-1" href="#flip">flip</a>
|
||||
<a class="sublink-1" href="#promisify">promisify</a>
|
||||
<a class="sublink-1" href="#spreadover">spreadOver</a>
|
||||
|
||||
@ -191,9 +192,6 @@
|
||||
<a class="sublink-1" href="#uuidgenerator">UUIDGenerator</a>
|
||||
<a class="sublink-1" href="#validatenumber">validateNumber</a>
|
||||
|
||||
<h3>Uncategorized
|
||||
</h3><a class="sublink-1" href="#flip">flip</a>
|
||||
|
||||
</nav><main class="col-sm-12 col-md-8 col-lg-9" style="height:100%;overflow-y:auto;background:#eceef2;padding:0"><a id="top"> </a><h2 style="text-align:center">Adapter</h2>
|
||||
<div class="card fluid"><div class="section double-padded"><h3 id="collectinto">collectInto</h3></div><div class="section double-padded">
|
||||
<p>Changes a function that accepts an array into a variadic function.</p>
|
||||
@ -207,6 +205,20 @@ let p3 = new Promise((resolve) => setTimeout(resolve,2000,3))
|
||||
Pall(p1, p2, p3).then(console.log)
|
||||
*/
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="flip">flip</h3></div><div class="section double-padded">
|
||||
<p>Flip takes a function as an argument, then makes the first argument the last</p>
|
||||
<p>Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest.</p>
|
||||
<pre><code class="language-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
|
||||
*/
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="promisify">promisify</h3></div><div class="section double-padded">
|
||||
<p>Converts an asynchronous function to return a promise.</p>
|
||||
<p>Use currying to return a function returning a <code>Promise</code> that calls the original function.
|
||||
@ -1349,21 +1361,6 @@ Use <code>Number()</code> to check if the coercion holds.</p>
|
||||
<pre><code class="language-js">const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n;
|
||||
// validateNumber('10') -> true
|
||||
</code></pre>
|
||||
</div></div><br/><h2 style="text-align:center">Uncategorized</h2>
|
||||
<div class="card fluid"><div class="section double-padded"><h3 id="flip">flip</h3></div><div class="section double-padded">
|
||||
<p>Flip takes a function as an argument, then makes the first argument the last</p>
|
||||
<p>Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest.</p>
|
||||
<pre><code class="language-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
|
||||
*/
|
||||
</code></pre>
|
||||
</div></div><br/>
|
||||
<footer>
|
||||
<p style="display:inline-block"><strong>30 seconds of code</strong> is licensed under the <a href="https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE">CC0-1.0</a> license.<br/>Icons made by <a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a>.<br/>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed by <a href="https://opensource.org/licenses/MIT">The MIT License</a><br/>Built with the <a href="https://minicss.org">mini.css framework</a>.</p>
|
||||
|
||||
Reference in New Issue
Block a user