Travis build: 534
This commit is contained in:
232
README.md
232
README.md
@ -140,6 +140,7 @@
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
|
||||
* [`average`](#average)
|
||||
* [`clampNumber`](#clampnumber)
|
||||
* [`collatz`](#collatz)
|
||||
* [`digitize`](#digitize)
|
||||
@ -156,7 +157,9 @@
|
||||
* [`isEven`](#iseven)
|
||||
* [`isPrime`](#isprime)
|
||||
* [`lcm`](#lcm)
|
||||
* [`max`](#max)
|
||||
* [`median`](#median)
|
||||
* [`min`](#min)
|
||||
* [`palindrome`](#palindrome)
|
||||
* [`percentile`](#percentile)
|
||||
* [`powerset`](#powerset)
|
||||
@ -165,6 +168,7 @@
|
||||
* [`randomNumberInRange`](#randomnumberinrange)
|
||||
* [`round`](#round)
|
||||
* [`standardDeviation`](#standarddeviation)
|
||||
* [`sum`](#sum)
|
||||
|
||||
</details>
|
||||
|
||||
@ -251,18 +255,6 @@
|
||||
|
||||
</details>
|
||||
|
||||
### _Uncategorized_
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
|
||||
* [`average`](#average)
|
||||
* [`max`](#max)
|
||||
* [`min`](#min)
|
||||
* [`sum`](#sum)
|
||||
|
||||
</details>
|
||||
|
||||
## Adapter
|
||||
|
||||
### call
|
||||
@ -2213,6 +2205,29 @@ negate(isOdd)(1); // false
|
||||
|
||||
## Math
|
||||
|
||||
### average
|
||||
|
||||
Returns the average of an of two or more numbers/arrays.
|
||||
|
||||
Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`, divide by the `length` of the array.
|
||||
|
||||
```js
|
||||
const average = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0) / arr.length;
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
average([1, 2, 3]); // 2
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### clampNumber
|
||||
|
||||
Clamps `num` within the inclusive range specified by the boundary values `a` and `b`.
|
||||
@ -2641,6 +2656,57 @@ lcm([1, 3, 4], 5); // 60
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### max
|
||||
|
||||
Returns the maximum value out of two or more numbers/arrays.
|
||||
|
||||
Use `Math.max()` combined with the spread operator (`...`) to get the maximum value in the array.
|
||||
|
||||
```js
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const max = (...arr) => Math.max(...[].concat(...arr);
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
max([10, 1, 5]); // 10
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### median
|
||||
|
||||
Returns the median of an array of numbers.
|
||||
@ -2670,6 +2736,29 @@ median([0, 10, -2, 7]); // 3.5
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### min
|
||||
|
||||
Returns the minimum value in an array.
|
||||
|
||||
Use `Math.min()` combined with the spread operator (`...`) to get the minimum value in the array.
|
||||
|
||||
```js
|
||||
const min = arr => Math.min(...[].concat(...arr));
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
min([10, 1, 5]); // 1
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### palindrome
|
||||
|
||||
Returns `true` if the given string is a palindrome, `false` otherwise.
|
||||
@ -2880,6 +2969,29 @@ standardDeviation([10, 2, 38, 23, 38, 23, 21], true); // 12.29899614287479 (popu
|
||||
</details>
|
||||
|
||||
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### sum
|
||||
|
||||
Returns the sum of an of two or more numbers/arrays.
|
||||
|
||||
Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`.
|
||||
|
||||
```js
|
||||
const sum = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0);
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
sum([1, 2, 3, 4]); // 10
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
## Media
|
||||
@ -4074,102 +4186,6 @@ validateNumber('10'); // true
|
||||
|
||||
[⬆ Back to top](#table-of-contents)
|
||||
|
||||
## _Uncategorized_
|
||||
|
||||
### average
|
||||
|
||||
Returns the average of an of two or more numbers/arrays.
|
||||
|
||||
Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`, divide by the `length` of the array.
|
||||
|
||||
```js
|
||||
const average = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0) / arr.length;
|
||||
```
|
||||
|
||||
```js
|
||||
average([1, 2, 3]); // 2
|
||||
```
|
||||
|
||||
<br>[⬆ back to top](#table-of-contents)
|
||||
|
||||
|
||||
### max
|
||||
|
||||
Returns the maximum value out of two or more numbers/arrays.
|
||||
|
||||
Use `Math.max()` combined with the spread operator (`...`) to get the maximum value in the array.
|
||||
|
||||
```js
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const max = (...arr) => Math.max(...[].concat(...arr);
|
||||
```
|
||||
|
||||
```js
|
||||
max([10, 1, 5]); // 10
|
||||
```
|
||||
|
||||
<br>[⬆ back to top](#table-of-contents)
|
||||
|
||||
|
||||
### min
|
||||
|
||||
Returns the minimum value in an array.
|
||||
|
||||
Use `Math.min()` combined with the spread operator (`...`) to get the minimum value in the array.
|
||||
|
||||
```js
|
||||
const min = arr => Math.min(...[].concat(...arr));
|
||||
```
|
||||
|
||||
```js
|
||||
min([10, 1, 5]); // 1
|
||||
```
|
||||
|
||||
<br>[⬆ back to top](#table-of-contents)
|
||||
|
||||
|
||||
### sum
|
||||
|
||||
Returns the sum of an of two or more numbers/arrays.
|
||||
|
||||
Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`.
|
||||
|
||||
```js
|
||||
const sum = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0);
|
||||
```
|
||||
|
||||
```js
|
||||
sum([1, 2, 3, 4]); // 10
|
||||
```
|
||||
|
||||
<br>[⬆ back to top](#table-of-contents)
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
|
||||
126
docs/index.html
126
docs/index.html
@ -185,7 +185,8 @@
|
||||
</h3><a class="sublink-1" href="#negate">negate</a>
|
||||
|
||||
<h3>Math
|
||||
</h3><a class="sublink-1" href="#clampnumber">clampNumber</a>
|
||||
</h3><a class="sublink-1" href="#average">average</a>
|
||||
<a class="sublink-1" href="#clampnumber">clampNumber</a>
|
||||
<a class="sublink-1" href="#collatz">collatz</a>
|
||||
<a class="sublink-1" href="#digitize">digitize</a>
|
||||
<a class="sublink-1" href="#distance">distance</a>
|
||||
@ -201,7 +202,9 @@
|
||||
<a class="sublink-1" href="#iseven">isEven</a>
|
||||
<a class="sublink-1" href="#isprime">isPrime</a>
|
||||
<a class="sublink-1" href="#lcm">lcm</a>
|
||||
<a class="sublink-1" href="#max">max</a>
|
||||
<a class="sublink-1" href="#median">median</a>
|
||||
<a class="sublink-1" href="#min">min</a>
|
||||
<a class="sublink-1" href="#palindrome">palindrome</a>
|
||||
<a class="sublink-1" href="#percentile">percentile</a>
|
||||
<a class="sublink-1" href="#powerset">powerset</a>
|
||||
@ -210,6 +213,7 @@
|
||||
<a class="sublink-1" href="#randomnumberinrange">randomNumberInRange</a>
|
||||
<a class="sublink-1" href="#round">round</a>
|
||||
<a class="sublink-1" href="#standarddeviation">standardDeviation</a>
|
||||
<a class="sublink-1" href="#sum">sum</a>
|
||||
|
||||
<h3>Media
|
||||
</h3><a class="sublink-1" href="#speechsynthesis">speechSynthesis</a>
|
||||
@ -264,12 +268,6 @@
|
||||
<a class="sublink-1" href="#toordinalsuffix">toOrdinalSuffix</a>
|
||||
<a class="sublink-1" href="#validatenumber">validateNumber</a>
|
||||
|
||||
<h3>Uncategorized
|
||||
</h3><a class="sublink-1" href="#average">average</a>
|
||||
<a class="sublink-1" href="#max">max</a>
|
||||
<a class="sublink-1" href="#min">min</a>
|
||||
<a class="sublink-1" href="#sum">sum</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="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>
|
||||
@ -1035,7 +1033,14 @@ runPromisesInSeries([() => delay(1000), () => delay(2000)]); // //executes
|
||||
negate(isOdd)(1); // false
|
||||
</code></pre>
|
||||
</div></div><br/><h2 style="text-align:center">Math</h2>
|
||||
<div class="card fluid"><div class="section double-padded"><h3 id="clampnumber">clampNumber</h3></div><div class="section double-padded">
|
||||
<div class="card fluid"><div class="section double-padded"><h3 id="average">average</h3></div><div class="section double-padded">
|
||||
<p>Returns the average of an of two or more numbers/arrays.</p>
|
||||
<p>Use <code>Array.reduce()</code> to add each value to an accumulator, initialized with a value of <code>0</code>, divide by the <code>length</code> of the array.</p>
|
||||
<pre><code class="language-js">const average = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0) / arr.length;
|
||||
</code></pre>
|
||||
<pre><code class="language-js">average([1, 2, 3]); // 2
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="clampnumber">clampNumber</h3></div><div class="section double-padded">
|
||||
<p>Clamps <code>num</code> within the inclusive range specified by the boundary values <code>a</code> and <code>b</code>.</p>
|
||||
<p>If <code>num</code> falls within the range, return <code>num</code>.
|
||||
Otherwise, return the nearest number in the range.</p>
|
||||
@ -1207,6 +1212,41 @@ The GCD formula uses recursion.</p>
|
||||
<pre><code class="language-js">lcm(12, 7); // 84
|
||||
lcm([1, 3, 4], 5); // 60
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="max">max</h3></div><div class="section double-padded">
|
||||
<p>Returns the maximum value out of two or more numbers/arrays.</p>
|
||||
<p>Use <code>Math.max()</code> combined with the spread operator (<code>...</code>) to get the maximum value in the array.</p>
|
||||
<pre><code class="language-js">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const max = (...arr) => Math.max(...[].concat(...arr);
|
||||
</code></pre>
|
||||
<pre><code class="language-js">max([10, 1, 5]); // 10
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="median">median</h3></div><div class="section double-padded">
|
||||
<p>Returns the median of an array of numbers.</p>
|
||||
<p>Find the middle of the array, use <code>Array.sort()</code> to sort the values.
|
||||
@ -1220,6 +1260,13 @@ Return the number at the midpoint if <code>length</code> is odd, otherwise the a
|
||||
<pre><code class="language-js">median([5, 6, 50, 1, -5]); // 5
|
||||
median([0, 10, -2, 7]); // 3.5
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="min">min</h3></div><div class="section double-padded">
|
||||
<p>Returns the minimum value in an array.</p>
|
||||
<p>Use <code>Math.min()</code> combined with the spread operator (<code>...</code>) to get the minimum value in the array.</p>
|
||||
<pre><code class="language-js">const min = arr => Math.min(...[].concat(...arr));
|
||||
</code></pre>
|
||||
<pre><code class="language-js">min([10, 1, 5]); // 1
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="palindrome">palindrome</h3></div><div class="section double-padded">
|
||||
<p>Returns <code>true</code> if the given string is a palindrome, <code>false</code> otherwise.</p>
|
||||
<p>Convert string <code>toLowerCase()</code> and use <code>replace()</code> to remove non-alphanumeric characters from it.
|
||||
@ -1305,6 +1352,13 @@ You can omit the second argument to get the sample standard deviation or set it
|
||||
<pre><code class="language-js">standardDeviation([10, 2, 38, 23, 38, 23, 21]); // 13.284434142114991 (sample)
|
||||
standardDeviation([10, 2, 38, 23, 38, 23, 21], true); // 12.29899614287479 (population)
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="sum">sum</h3></div><div class="section double-padded">
|
||||
<p>Returns the sum of an of two or more numbers/arrays.</p>
|
||||
<p>Use <code>Array.reduce()</code> to add each value to an accumulator, initialized with a value of <code>0</code>.</p>
|
||||
<pre><code class="language-js">const sum = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0);
|
||||
</code></pre>
|
||||
<pre><code class="language-js">sum([1, 2, 3, 4]); // 10
|
||||
</code></pre>
|
||||
</div></div><br/><h2 style="text-align:center">Media</h2>
|
||||
<div class="card fluid"><div class="section double-padded"><h3 id="speechsynthesis">speechSynthesis</h3></div><div class="section double-padded">
|
||||
<p>Performs speech synthesis (experimental).</p>
|
||||
@ -1810,62 +1864,6 @@ Use <code>Number()</code> to check if the coercion holds.</p>
|
||||
</code></pre>
|
||||
<pre><code class="language-js">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="average">average</h3></div><div class="section double-padded">
|
||||
<p>Returns the average of an of two or more numbers/arrays.</p>
|
||||
<p>Use <code>Array.reduce()</code> to add each value to an accumulator, initialized with a value of <code>0</code>, divide by the <code>length</code> of the array.</p>
|
||||
<pre><code class="language-js">const average = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0) / arr.length;
|
||||
</code></pre>
|
||||
<pre><code class="language-js">average([1, 2, 3]); // 2
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="max">max</h3></div><div class="section double-padded">
|
||||
<p>Returns the maximum value out of two or more numbers/arrays.</p>
|
||||
<p>Use <code>Math.max()</code> combined with the spread operator (<code>...</code>) to get the maximum value in the array.</p>
|
||||
<pre><code class="language-js">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const max = (...arr) => Math.max(...[].concat(...arr);
|
||||
</code></pre>
|
||||
<pre><code class="language-js">max([10, 1, 5]); // 10
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="min">min</h3></div><div class="section double-padded">
|
||||
<p>Returns the minimum value in an array.</p>
|
||||
<p>Use <code>Math.min()</code> combined with the spread operator (<code>...</code>) to get the minimum value in the array.</p>
|
||||
<pre><code class="language-js">const min = arr => Math.min(...[].concat(...arr));
|
||||
</code></pre>
|
||||
<pre><code class="language-js">min([10, 1, 5]); // 1
|
||||
</code></pre>
|
||||
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="sum">sum</h3></div><div class="section double-padded">
|
||||
<p>Returns the sum of an of two or more numbers/arrays.</p>
|
||||
<p>Use <code>Array.reduce()</code> to add each value to an accumulator, initialized with a value of <code>0</code>.</p>
|
||||
<pre><code class="language-js">const sum = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0);
|
||||
</code></pre>
|
||||
<pre><code class="language-js">sum([1, 2, 3, 4]); // 10
|
||||
</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>
|
||||
|
||||
@ -30,6 +30,7 @@ Use `Math.max()` combined with the spread operator (`...`) to get the maximum va
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const max = (...arr) => Math.max(...[].concat(...arr);
|
||||
|
||||
Reference in New Issue
Block a user