Travis build: 323
This commit is contained in:
83
README.md
83
README.md
@ -88,7 +88,6 @@
|
|||||||
* [`compose`](#compose)
|
* [`compose`](#compose)
|
||||||
* [`curry`](#curry)
|
* [`curry`](#curry)
|
||||||
* [`functionName`](#functionname)
|
* [`functionName`](#functionname)
|
||||||
* [`pipe`](#pipe)
|
|
||||||
* [`runPromisesInSeries`](#runpromisesinseries)
|
* [`runPromisesInSeries`](#runpromisesinseries)
|
||||||
* [`sleep`](#sleep)
|
* [`sleep`](#sleep)
|
||||||
|
|
||||||
@ -168,7 +167,6 @@
|
|||||||
* [`isNumber`](#isnumber)
|
* [`isNumber`](#isnumber)
|
||||||
* [`isString`](#isstring)
|
* [`isString`](#isstring)
|
||||||
* [`isSymbol`](#issymbol)
|
* [`isSymbol`](#issymbol)
|
||||||
* [`randomHexColorCode`](#randomhexcolorcode)
|
|
||||||
* [`RGBToHex`](#rgbtohex)
|
* [`RGBToHex`](#rgbtohex)
|
||||||
* [`timeTaken`](#timetaken)
|
* [`timeTaken`](#timetaken)
|
||||||
* [`toDecimalMark`](#todecimalmark)
|
* [`toDecimalMark`](#todecimalmark)
|
||||||
@ -176,6 +174,10 @@
|
|||||||
* [`UUIDGenerator`](#uuidgenerator)
|
* [`UUIDGenerator`](#uuidgenerator)
|
||||||
* [`validateNumber`](#validatenumber)
|
* [`validateNumber`](#validatenumber)
|
||||||
|
|
||||||
|
### _Uncategorized_
|
||||||
|
* [`pipeFunctions`](#pipefunctions)
|
||||||
|
* [`randomHexColor`](#randomhexcolor)
|
||||||
|
|
||||||
## Adapter
|
## Adapter
|
||||||
|
|
||||||
### call
|
### call
|
||||||
@ -1239,25 +1241,6 @@ const functionName = fn => (console.debug(fn.name), fn);
|
|||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
### pipe
|
|
||||||
|
|
||||||
Performs left-to-right function composition.
|
|
||||||
|
|
||||||
Use `Array.reduce()` with the spread operator (`...`) to perform left-to-right function composition.
|
|
||||||
The first (leftmost) function can accept one or more arguments; the remaining functions must be unary.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
|
|
||||||
/*
|
|
||||||
const add5 = x => x + 5
|
|
||||||
const multiply = (x, y) => x * y
|
|
||||||
const multiplyAndAdd5 = pipeFunctions(multiply, add5)
|
|
||||||
multiplyAndAdd5(5, 2) -> 15
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
|
||||||
|
|
||||||
### runPromisesInSeries
|
### runPromisesInSeries
|
||||||
|
|
||||||
Runs an array of promises in series.
|
Runs an array of promises in series.
|
||||||
@ -2321,25 +2304,6 @@ const isSymbol = val => typeof val === 'symbol';
|
|||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
### randomHexColorCode
|
|
||||||
|
|
||||||
Generates a random hexadecimal color code.
|
|
||||||
|
|
||||||
Use `Math.random` to generate a random 24-bit(6x4bits) hexadecimal number. Use bit shifting and then convert it to an hexadecimal String using `toString(16)`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const randomHexColor = () => {
|
|
||||||
let n = (Math.random()*0xfffff|0).toString(16);
|
|
||||||
return '#' + (n.length !== 6
|
|
||||||
? (Math.random()*0xf|0).toString(16) + n : n);
|
|
||||||
}
|
|
||||||
// randomHexColorCode() -> "#e34155"
|
|
||||||
// randomHexColorCode() -> "#fd73a6"
|
|
||||||
// randomHexColorCode() -> "#4144c6"
|
|
||||||
```
|
|
||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
|
||||||
|
|
||||||
### RGBToHex
|
### RGBToHex
|
||||||
|
|
||||||
Converts the values of RGB components to a color code.
|
Converts the values of RGB components to a color code.
|
||||||
@ -2430,6 +2394,45 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) ==
|
|||||||
// validateNumber('10') -> true
|
// validateNumber('10') -> true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[⬆ back to top](#table-of-contents)
|
||||||
|
## _Uncategorized_
|
||||||
|
|
||||||
|
### pipeFunctions
|
||||||
|
|
||||||
|
Performs left-to-right function composition.
|
||||||
|
|
||||||
|
Use `Array.reduce()` with the spread operator (`...`) to perform left-to-right function composition.
|
||||||
|
The first (leftmost) function can accept one or more arguments; the remaining functions must be unary.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
|
||||||
|
/*
|
||||||
|
const add5 = x => x + 5
|
||||||
|
const multiply = (x, y) => x * y
|
||||||
|
const multiplyAndAdd5 = pipeFunctions(multiply, add5)
|
||||||
|
multiplyAndAdd5(5, 2) -> 15
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
|
||||||
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
|
### randomHexColor
|
||||||
|
|
||||||
|
Generates a random hexadecimal color code.
|
||||||
|
|
||||||
|
Use `Math.random` to generate a random 24-bit(6x4bits) hexadecimal number. Use bit shifting and then convert it to an hexadecimal String using `toString(16)`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const randomHexColor = () => {
|
||||||
|
let n = (Math.random()*0xfffff|0).toString(16);
|
||||||
|
return '#' + (n.length !== 6
|
||||||
|
? (Math.random()*0xf|0).toString(16) + n : n);
|
||||||
|
}
|
||||||
|
// randomHexColorCode() -> "#e34155"
|
||||||
|
// randomHexColorCode() -> "#fd73a6"
|
||||||
|
// randomHexColorCode() -> "#4144c6"
|
||||||
|
```
|
||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|||||||
@ -149,7 +149,6 @@
|
|||||||
<a class="sublink-1" href="#compose">compose</a>
|
<a class="sublink-1" href="#compose">compose</a>
|
||||||
<a class="sublink-1" href="#curry">curry</a>
|
<a class="sublink-1" href="#curry">curry</a>
|
||||||
<a class="sublink-1" href="#functionname">functionName</a>
|
<a class="sublink-1" href="#functionname">functionName</a>
|
||||||
<a class="sublink-1" href="#pipe">pipe</a>
|
|
||||||
<a class="sublink-1" href="#runpromisesinseries">runPromisesInSeries</a>
|
<a class="sublink-1" href="#runpromisesinseries">runPromisesInSeries</a>
|
||||||
<a class="sublink-1" href="#sleep">sleep</a>
|
<a class="sublink-1" href="#sleep">sleep</a>
|
||||||
|
|
||||||
@ -229,7 +228,6 @@
|
|||||||
<a class="sublink-1" href="#isnumber">isNumber</a>
|
<a class="sublink-1" href="#isnumber">isNumber</a>
|
||||||
<a class="sublink-1" href="#isstring">isString</a>
|
<a class="sublink-1" href="#isstring">isString</a>
|
||||||
<a class="sublink-1" href="#issymbol">isSymbol</a>
|
<a class="sublink-1" href="#issymbol">isSymbol</a>
|
||||||
<a class="sublink-1" href="#randomhexcolorcode">randomHexColorCode</a>
|
|
||||||
<a class="sublink-1" href="#rgbtohex">RGBToHex</a>
|
<a class="sublink-1" href="#rgbtohex">RGBToHex</a>
|
||||||
<a class="sublink-1" href="#timetaken">timeTaken</a>
|
<a class="sublink-1" href="#timetaken">timeTaken</a>
|
||||||
<a class="sublink-1" href="#todecimalmark">toDecimalMark</a>
|
<a class="sublink-1" href="#todecimalmark">toDecimalMark</a>
|
||||||
@ -237,6 +235,10 @@
|
|||||||
<a class="sublink-1" href="#uuidgenerator">UUIDGenerator</a>
|
<a class="sublink-1" href="#uuidgenerator">UUIDGenerator</a>
|
||||||
<a class="sublink-1" href="#validatenumber">validateNumber</a>
|
<a class="sublink-1" href="#validatenumber">validateNumber</a>
|
||||||
|
|
||||||
|
<h3>Uncategorized
|
||||||
|
</h3><a class="sublink-1" href="#pipefunctions">pipeFunctions</a>
|
||||||
|
<a class="sublink-1" href="#randomhexcolor">randomHexColor</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>
|
</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="call">call</h3></div><div class="section double-padded">
|
<div class="card fluid"><div class="section double-padded"><h3 id="call">call</h3></div><div class="section double-padded">
|
||||||
<p>Given a key and a set of arguments, call them when given a context. Primarily useful in composition.</p>
|
<p>Given a key and a set of arguments, call them when given a context. Primarily useful in composition.</p>
|
||||||
@ -835,18 +837,6 @@ If you want to curry a function that accepts a variable number of arguments (a v
|
|||||||
<pre><code class="language-js">const functionName = fn => (console.debug(fn.name), fn);
|
<pre><code class="language-js">const functionName = fn => (console.debug(fn.name), fn);
|
||||||
// functionName(Math.max) -> max (logged in debug channel of console)
|
// functionName(Math.max) -> max (logged in debug channel of console)
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="pipe">pipe</h3></div><div class="section double-padded">
|
|
||||||
<p>Performs left-to-right function composition.</p>
|
|
||||||
<p>Use <code>Array.reduce()</code> with the spread operator (<code>...</code>) to perform left-to-right function composition.
|
|
||||||
The first (leftmost) function can accept one or more arguments; the remaining functions must be unary.</p>
|
|
||||||
<pre><code class="language-js">const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
|
|
||||||
/*
|
|
||||||
const add5 = x => x + 5
|
|
||||||
const multiply = (x, y) => x * y
|
|
||||||
const multiplyAndAdd5 = pipeFunctions(multiply, add5)
|
|
||||||
multiplyAndAdd5(5, 2) -> 15
|
|
||||||
*/
|
|
||||||
</code></pre>
|
|
||||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="runpromisesinseries">runPromisesInSeries</h3></div><div class="section double-padded">
|
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="runpromisesinseries">runPromisesInSeries</h3></div><div class="section double-padded">
|
||||||
<p>Runs an array of promises in series.</p>
|
<p>Runs an array of promises in series.</p>
|
||||||
<p>Use <code>Array.reduce()</code> to create a promise chain, where each promise returns the next promise when resolved.</p>
|
<p>Use <code>Array.reduce()</code> to create a promise chain, where each promise returns the next promise when resolved.</p>
|
||||||
@ -1455,18 +1445,6 @@ Omit the second argument to use the default regex.</p>
|
|||||||
// isSymbol('x') -> false
|
// isSymbol('x') -> false
|
||||||
// isSymbol(Symbol('x')) -> true
|
// isSymbol(Symbol('x')) -> true
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="randomhexcolorcode">randomHexColorCode</h3></div><div class="section double-padded">
|
|
||||||
<p>Generates a random hexadecimal color code.</p>
|
|
||||||
<p>Use <code>Math.random</code> to generate a random 24-bit(6x4bits) hexadecimal number. Use bit shifting and then convert it to an hexadecimal String using <code>toString(16)</code>.</p>
|
|
||||||
<pre><code class="language-js">const randomHexColor = () => {
|
|
||||||
let n = (Math.random()*0xfffff|0).toString(16);
|
|
||||||
return '#' + (n.length !== 6
|
|
||||||
? (Math.random()*0xf|0).toString(16) + n : n);
|
|
||||||
}
|
|
||||||
// randomHexColorCode() -> "#e34155"
|
|
||||||
// randomHexColorCode() -> "#fd73a6"
|
|
||||||
// randomHexColorCode() -> "#4144c6"
|
|
||||||
</code></pre>
|
|
||||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="rgbtohex">RGBToHex</h3></div><div class="section double-padded">
|
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="rgbtohex">RGBToHex</h3></div><div class="section double-padded">
|
||||||
<p>Converts the values of RGB components to a color code.</p>
|
<p>Converts the values of RGB components to a color code.</p>
|
||||||
<p>Convert given RGB parameters to hexadecimal string using bitwise left-shift operator (<code><<</code>) and <code>toString(16)</code>, then <code>padStart(6,'0')</code> to get a 6-digit hexadecimal value.</p>
|
<p>Convert given RGB parameters to hexadecimal string using bitwise left-shift operator (<code><<</code>) and <code>toString(16)</code>, then <code>padStart(6,'0')</code> to get a 6-digit hexadecimal value.</p>
|
||||||
@ -1518,6 +1496,31 @@ 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;
|
<pre><code class="language-js">const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n;
|
||||||
// validateNumber('10') -> true
|
// validateNumber('10') -> true
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
</div></div><br/><h2 style="text-align:center">Uncategorized</h2>
|
||||||
|
<div class="card fluid"><div class="section double-padded"><h3 id="pipefunctions">pipeFunctions</h3></div><div class="section double-padded">
|
||||||
|
<p>Performs left-to-right function composition.</p>
|
||||||
|
<p>Use <code>Array.reduce()</code> with the spread operator (<code>...</code>) to perform left-to-right function composition.
|
||||||
|
The first (leftmost) function can accept one or more arguments; the remaining functions must be unary.</p>
|
||||||
|
<pre><code class="language-js">const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
|
||||||
|
/*
|
||||||
|
const add5 = x => x + 5
|
||||||
|
const multiply = (x, y) => x * y
|
||||||
|
const multiplyAndAdd5 = pipeFunctions(multiply, add5)
|
||||||
|
multiplyAndAdd5(5, 2) -> 15
|
||||||
|
*/
|
||||||
|
</code></pre>
|
||||||
|
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="randomhexcolor">randomHexColor</h3></div><div class="section double-padded">
|
||||||
|
<p>Generates a random hexadecimal color code.</p>
|
||||||
|
<p>Use <code>Math.random</code> to generate a random 24-bit(6x4bits) hexadecimal number. Use bit shifting and then convert it to an hexadecimal String using <code>toString(16)</code>.</p>
|
||||||
|
<pre><code class="language-js">const randomHexColor = () => {
|
||||||
|
let n = (Math.random()*0xfffff|0).toString(16);
|
||||||
|
return '#' + (n.length !== 6
|
||||||
|
? (Math.random()*0xf|0).toString(16) + n : n);
|
||||||
|
}
|
||||||
|
// randomHexColorCode() -> "#e34155"
|
||||||
|
// randomHexColorCode() -> "#fd73a6"
|
||||||
|
// randomHexColorCode() -> "#4144c6"
|
||||||
|
</code></pre>
|
||||||
</div></div><br/>
|
</div></div><br/>
|
||||||
<footer>
|
<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>
|
<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>
|
||||||
|
|||||||
@ -87,14 +87,14 @@ orderBy:object
|
|||||||
palindrome:math
|
palindrome:math
|
||||||
percentile:math
|
percentile:math
|
||||||
pick:array
|
pick:array
|
||||||
pipe:function
|
pipeFunctions:uncategorized
|
||||||
powerset:math
|
powerset:math
|
||||||
primes:math
|
primes:math
|
||||||
promisify:adapter
|
promisify:adapter
|
||||||
pull:array
|
pull:array
|
||||||
pullAtIndex:array
|
pullAtIndex:array
|
||||||
pullAtValue:array
|
pullAtValue:array
|
||||||
randomHexColorCode:utility
|
randomHexColor:uncategorized
|
||||||
randomIntegerInRange:math
|
randomIntegerInRange:math
|
||||||
randomNumberInRange:math
|
randomNumberInRange:math
|
||||||
readFileLines:node
|
readFileLines:node
|
||||||
|
|||||||
Reference in New Issue
Block a user