From 7df14030d51b205f479dd95afb468f7d2dca0356 Mon Sep 17 00:00:00 2001 From: atomiks Date: Sun, 31 Dec 2017 03:57:00 +1100 Subject: [PATCH] revert README back --- README.md | 139 +++++++++++++++++++++++++----------------------------- 1 file changed, 63 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 16e26af95..d3467da01 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## Table of Contents -### 🔌 Adapter +### Adapter
View contents @@ -28,7 +28,7 @@
-### 📚 Array +### Array
View contents @@ -76,7 +76,7 @@
-### 🖥️ Browser +### Browser
View contents @@ -102,7 +102,7 @@
-### ⏱️ Date +### Date
View contents @@ -114,7 +114,7 @@
-### 🎛️ Function +### Function
View contents @@ -128,7 +128,7 @@
-### 🔮 Logic +### Logic
View contents @@ -137,7 +137,7 @@
-### ➗ Math +### Math
View contents @@ -173,7 +173,7 @@
-### 📺 Media +### Media
View contents @@ -182,7 +182,7 @@
-### 📦 Node +### Node
View contents @@ -193,7 +193,7 @@
-### 🗃️ Object +### Object
View contents @@ -209,7 +209,7 @@
-### 📜 String +### String
View contents @@ -236,7 +236,7 @@
-### 💎 Utility +### Utility
View contents @@ -262,19 +262,18 @@
---- - ## 🔌 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); -``` - +``` +
Examples @@ -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 ] -``` +```

[⬆ 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); -``` - +``` +
Examples @@ -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); -``` +```

[⬆ 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); -``` - +``` +
Examples @@ -340,7 +339,7 @@ let mergePerson = mergeFrom.bind(null, a); mergePerson(b); // == b b = {}; Object.assign(b, a); // == b -``` +```
@@ -402,16 +401,16 @@ delay(2000).then(() => console.log('Hi!')); // // Promise resolves after 2s
[⬆ 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); -``` - +``` +
Examples @@ -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 -``` +```

[⬆ 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}
[⬆ 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'
[⬆ Back to top](#table-of-contents) ---- - ## ⏱️ Date +## Date ### getDaysDiffBetweenDates @@ -1992,8 +1988,7 @@ tomorrow(); // 2017-12-27 (if current date is 2017-12-26)
[⬆ Back to top](#table-of-contents) ---- - ## 🎛️ Function +## Function ### chainAsync @@ -2156,8 +2151,7 @@ async function sleepyWork() {
[⬆ Back to top](#table-of-contents) ---- - ## 🔮 Logic +## Logic ### negate @@ -2181,8 +2175,7 @@ negate(isOdd)(1); // false
[⬆ Back to top](#table-of-contents) ---- - ## ➗ Math +## Math ### average @@ -2887,8 +2880,7 @@ sum([1, 2, 3, 4]); // 10
[⬆ Back to top](#table-of-contents) ---- - ## 📺 Media +## Media ### speechSynthesis @@ -2918,8 +2910,7 @@ speechSynthesis('Hello, World'); // // plays the message
[⬆ Back to top](#table-of-contents) ---- - ## 📦 Node +## Node ### JSONToFile @@ -3008,8 +2999,7 @@ UUIDGeneratorNode(); // '79c7c136-60ee-40a2-beb2-856f1feabefc'
[⬆ Back to top](#table-of-contents) ---- - ## 🗃️ Object +## Object ### cleanObj @@ -3224,8 +3214,7 @@ truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex
[⬆ Back to top](#table-of-contents) ---- - ## 📜 String +## String ### anagrams @@ -3749,8 +3738,7 @@ words('python, javaScript & coffee'); // ["python", "javaScript", "coffee"]
[⬆ 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/).* -