diff --git a/README.md b/README.md
index dad9a3785..1809f3b5b 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,7 @@
* [`call`](#call)
* [`collectInto`](#collectinto)
* [`flip`](#flip)
+* [`pipeFunctions`](#pipefunctions)
* [`promisify`](#promisify)
* [`spreadOver`](#spreadover)
@@ -121,6 +122,7 @@
* [`randomIntegerInRange`](#randomintegerinrange)
* [`randomNumberInRange`](#randomnumberinrange)
* [`round`](#round)
+* [`sdbmHashAlgorithm`](#sdbmhashalgorithm)
* [`standardDeviation`](#standarddeviation)
### Media
@@ -167,6 +169,7 @@
* [`isNumber`](#isnumber)
* [`isString`](#isstring)
* [`isSymbol`](#issymbol)
+* [`randomHexColor`](#randomhexcolor)
* [`RGBToHex`](#rgbtohex)
* [`timeTaken`](#timetaken)
* [`toDecimalMark`](#todecimalmark)
@@ -174,11 +177,6 @@
* [`UUIDGenerator`](#uuidgenerator)
* [`validateNumber`](#validatenumber)
-### _Uncategorized_
-* [`pipeFunctions`](#pipefunctions)
-* [`randomHexColor`](#randomhexcolor)
-* [`sdbmHashAlgorithm`](#sdbmhashalgorithm)
-
## Adapter
### call
@@ -238,6 +236,25 @@ Object.assign(b, a) // == b
[⬆ back to top](#table-of-contents)
+### 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)
+
### promisify
Converts an asynchronous function to return a promise.
@@ -1696,6 +1713,25 @@ const round = (n, decimals=0) => Number(`${Math.round(`${n}e${decimals}`)}e-${de
[⬆ back to top](#table-of-contents)
+### sdbmHashAlgorithm
+
+This algorithm is a simple hash-algorithm that hashes it input string `s` into a whole number.
+
+Use `split('')` and `Array.reduce()` to create a hash of the input string, utilizing bit shifting.
+
+``` js
+const sdbm = str => {
+ let arr = str.split('');
+ return arr.reduce((hashCode, currentVal) =>
+ hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode
+ ,0)
+}
+// console.log(sdbm("name")) // -3521204949
+// console.log(sdbm("age")) // 808122783
+```
+
+[⬆ back to top](#table-of-contents)
+
### standardDeviation
Returns the standard deviation of an array of numbers.
@@ -1794,12 +1830,12 @@ const cleanObj = (obj, keysToKeep = [], childIndicator) => {
} else if (!keysToKeep.includes(key)) {
delete obj[key];
}
- })
+ });
+ return obj;
}
/*
const testObj = {a: 1, b: 2, children: {a: 1, b: 2}}
- cleanObj(testObj, ["a"],"children")
- console.log(testObj)// { a: 1, children : { a: 1}}
+ cleanObj(testObj, ["a"],"children") // { a: 1, children : { a: 1}}
*/
```
@@ -2307,6 +2343,25 @@ const isSymbol = val => typeof val === 'symbol';
[⬆ 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)
+
### RGBToHex
Converts the values of RGB components to a color code.
@@ -2397,65 +2452,6 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) ==
// 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)
-
-### sdbmHashAlgorithm
-
-This algorithm is a simple hash-algorithm that hashes it input string `s` into a whole number.
-
-Use `split('')` and `Array.reduce()` to create a hash of the input string, utilizing bit shifting.
-
-``` js
-const sdbm = str => {
- let arr = str.split('');
- return arr.reduce((hashCode, currentVal) =>
- hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode
- ,0)
-}
-// console.log(sdbm("name")) // -3521204949
-// console.log(sdbm("age")) // 808122783
-```
-
-
[⬆ back to top](#table-of-contents)
## Credits
diff --git a/docs/index.html b/docs/index.html
index 2be8f92ee..937f4c803 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -78,6 +78,7 @@
call
collectInto
flip
+pipeFunctions
promisify
spreadOver
@@ -182,6 +183,7 @@
randomIntegerInRange
randomNumberInRange
round
+sdbmHashAlgorithm
standardDeviation
Media
@@ -228,6 +230,7 @@
isNumber
isString
isSymbol
+randomHexColor
RGBToHex
timeTaken
toDecimalMark
@@ -235,11 +238,6 @@
UUIDGenerator
validateNumber
-Uncategorized
-
pipeFunctions
-randomHexColor
-sdbmHashAlgorithm
-
Adapter
call
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
@@ -277,6 +275,18 @@ b = {}
Object.assign(b, a) // == b
*/
+
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.
+
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
+*/
+
promisify
Converts an asynchronous function to return a promise.
Use currying to return a function returning a Promise that calls the original function.
@@ -1089,6 +1099,18 @@ Omit the second argument, decimals to round to an integer.
const round = (n, decimals=0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`);
// round(1.005, 2) -> 1.01
+
sdbmHashAlgorithm
+
This algorithm is a simple hash-algorithm that hashes it input string s into a whole number.
+
Use split('') and Array.reduce() to create a hash of the input string, utilizing bit shifting.
+
const sdbm = str => {
+ let arr = str.split('');
+ return arr.reduce((hashCode, currentVal) =>
+ hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode
+ ,0)
+}
+// console.log(sdbm("name")) // -3521204949
+// console.log(sdbm("age")) // 808122783
+
standardDeviation
Returns the standard deviation of an array of numbers.
Use Array.reduce() to calculate the mean, variance and the sum of the variance of the values, the variance of the values, then
@@ -1154,12 +1176,12 @@ Also if you give it a special key (childIndicator) it will search d
} else if (!keysToKeep.includes(key)) {
delete obj[key];
}
- })
+ });
+ return obj;
}
/*
const testObj = {a: 1, b: 2, children: {a: 1, b: 2}}
- cleanObj(testObj, ["a"],"children")
- console.log(testObj)// { a: 1, children : { a: 1}}
+ cleanObj(testObj, ["a"],"children") // { a: 1, children : { a: 1}}
*/
objectFromPairs
@@ -1448,6 +1470,18 @@ Omit the second argument to use the default regex.
// isSymbol('x') -> false
// isSymbol(Symbol('x')) -> true
+
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).
+
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"
+
RGBToHex
Converts the values of RGB components to a color code.
Convert given RGB parameters to hexadecimal string using bitwise left-shift operator (<<) and toString(16), then padStart(6,'0') to get a 6-digit hexadecimal value.
@@ -1499,43 +1533,6 @@ Use
Number() to check if the coercion holds.
const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n;
// validateNumber('10') -> true
-
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.
-
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
-*/
-
-
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).
-
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"
-
-
sdbmHashAlgorithm
-
This algorithm is a simple hash-algorithm that hashes it input string s into a whole number.
-
Use split('') and Array.reduce() to create a hash of the input string, utilizing bit shifting.
-
const sdbm = str => {
- let arr = str.split('');
- return arr.reduce((hashCode, currentVal) =>
- hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode
- ,0)
-}
-// console.log(sdbm("name")) // -3521204949
-// console.log(sdbm("age")) // 808122783
-