revert README back
This commit is contained in:
139
README.md
139
README.md
@ -14,7 +14,7 @@
|
||||
|
||||
## Table of Contents
|
||||
|
||||
### 🔌 Adapter
|
||||
### Adapter
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 📚 Array
|
||||
### Array
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 🖥️ Browser
|
||||
### Browser
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -102,7 +102,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### ⏱️ Date
|
||||
### Date
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -114,7 +114,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 🎛️ Function
|
||||
### Function
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -128,7 +128,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 🔮 Logic
|
||||
### Logic
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -137,7 +137,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### ➗ Math
|
||||
### Math
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -173,7 +173,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 📺 Media
|
||||
### Media
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -182,7 +182,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 📦 Node
|
||||
### Node
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -193,7 +193,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 🗃️ Object
|
||||
### Object
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -209,7 +209,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 📜 String
|
||||
### String
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -236,7 +236,7 @@
|
||||
|
||||
</details>
|
||||
|
||||
### 💎 Utility
|
||||
### Utility
|
||||
|
||||
<details>
|
||||
<summary>View contents</summary>
|
||||
@ -262,19 +262,18 @@
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
## 🔌 Adapter
|
||||
## Adapter
|
||||
|
||||
### call
|
||||
|
||||
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
|
||||
|
||||
Use a closure to call a stored key with stored arguments.
|
||||
|
||||
### call
|
||||
|
||||
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
|
||||
|
||||
Use a closure to call a stored key with stored arguments.
|
||||
|
||||
```js
|
||||
const call = (key, ...args) => context => context[key](...args);
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
@ -286,23 +285,23 @@ const map = call.bind(null, 'map');
|
||||
Promise.resolve([1, 2, 3])
|
||||
.then(map(x => 2 * x))
|
||||
.then(console.log); //[ 2, 4, 6 ]
|
||||
```
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### collectInto
|
||||
|
||||
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.
|
||||
|
||||
### collectInto
|
||||
|
||||
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);
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
@ -312,23 +311,23 @@ 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);
|
||||
```
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ 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.
|
||||
|
||||
### 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);
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
@ -340,7 +339,7 @@ let mergePerson = mergeFrom.bind(null, a);
|
||||
mergePerson(b); // == b
|
||||
b = {};
|
||||
Object.assign(b, a); // == b
|
||||
```
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
@ -402,16 +401,16 @@ delay(2000).then(() => console.log('Hi!')); // // Promise resolves after 2s
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### spreadOver
|
||||
|
||||
Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.
|
||||
|
||||
Use closures and the spread operator (`...`) to map the array of arguments to the inputs of the function.
|
||||
|
||||
### spreadOver
|
||||
|
||||
Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.
|
||||
|
||||
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);
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
@ -419,14 +418,13 @@ const spreadOver = fn => argsArr => fn(...argsArr);
|
||||
const arrayMax = spreadOver(Math.max);
|
||||
arrayMax([1, 2, 3]); // 3
|
||||
arrayMax([1, 2, 4]); // 4
|
||||
```
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 📚 Array
|
||||
## Array
|
||||
|
||||
### chunk
|
||||
|
||||
@ -1112,8 +1110,8 @@ console.log(pulled); // [ 'b', 'd' ]
|
||||
|
||||
QuickSort an Array (ascending sort by default).
|
||||
|
||||
Use recursion.
|
||||
Use `Array.filter` and spread operator (`...`) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it.
|
||||
Use recursion.
|
||||
Use `Array.filter` and spread operator (`...`) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it.
|
||||
If the parameter `desc` is truthy, return array sorts in descending order.
|
||||
|
||||
```js
|
||||
@ -1439,8 +1437,7 @@ zipObject(['a', 'b'], [1, 2, 3]); // {a: 1, b: 2}
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 🖥️ Browser
|
||||
## Browser
|
||||
|
||||
### arrayToHtmlList
|
||||
|
||||
@ -1713,7 +1710,7 @@ const httpsRedirect = () => {
|
||||
|
||||
Run the callback whenever the user input type changes (`mouse` or `touch`). Useful for enabling/disabling code depending on the input device. This process is dynamic and works with hybrid devices (e.g. touchscreen laptops).
|
||||
|
||||
Use two event listeners. Assume `mouse` input initially and bind a `touchstart` event listener to the document.
|
||||
Use two event listeners. Assume `mouse` input initially and bind a `touchstart` event listener to the document.
|
||||
On `touchstart`, add a `mousemove` event listener to listen for two consecutive `mousemove` events firing within 20ms, using `performance.now()`.
|
||||
Run the callback with the input type as an argument in either of these situations.
|
||||
|
||||
@ -1891,8 +1888,7 @@ UUIDGeneratorBrowser(); // '7982fcfe-5721-4632-bede-6000885be57d'
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## ⏱️ Date
|
||||
## Date
|
||||
|
||||
### getDaysDiffBetweenDates
|
||||
|
||||
@ -1992,8 +1988,7 @@ tomorrow(); // 2017-12-27 (if current date is 2017-12-26)
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 🎛️ Function
|
||||
## Function
|
||||
|
||||
### chainAsync
|
||||
|
||||
@ -2156,8 +2151,7 @@ async function sleepyWork() {
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 🔮 Logic
|
||||
## Logic
|
||||
|
||||
### negate
|
||||
|
||||
@ -2181,8 +2175,7 @@ negate(isOdd)(1); // false
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## ➗ Math
|
||||
## Math
|
||||
|
||||
### average
|
||||
|
||||
@ -2887,8 +2880,7 @@ sum([1, 2, 3, 4]); // 10
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 📺 Media
|
||||
## Media
|
||||
|
||||
### speechSynthesis
|
||||
|
||||
@ -2918,8 +2910,7 @@ speechSynthesis('Hello, World'); // // plays the message
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 📦 Node
|
||||
## Node
|
||||
|
||||
### JSONToFile
|
||||
|
||||
@ -3008,8 +2999,7 @@ UUIDGeneratorNode(); // '79c7c136-60ee-40a2-beb2-856f1feabefc'
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 🗃️ Object
|
||||
## Object
|
||||
|
||||
### cleanObj
|
||||
|
||||
@ -3224,8 +3214,7 @@ truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 📜 String
|
||||
## String
|
||||
|
||||
### anagrams
|
||||
|
||||
@ -3749,8 +3738,7 @@ words('python, javaScript & coffee'); // ["python", "javaScript", "coffee"]
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
---
|
||||
## 💎 Utility
|
||||
## Utility
|
||||
|
||||
### coalesce
|
||||
|
||||
@ -4215,4 +4203,3 @@ validateNumber('10'); // true
|
||||
## Credits
|
||||
|
||||
*Icons made by [Smashicons](https://www.flaticon.com/authors/smashicons) from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/).*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user