diff --git a/README.md b/README.md
index 99b31269b..23b545eb2 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,7 @@
* [`arrayToHtmlList`](#arraytohtmllist)
* [`bottomVisible`](#bottomvisible)
* [`currentURL`](#currenturl)
+* [`detectDeviceType`](#detectdevicetype)
* [`elementIsVisibleInViewport`](#elementisvisibleinviewport)
* [`getScrollPosition`](#getscrollposition)
* [`getURLParameters`](#geturlparameters)
@@ -90,6 +91,9 @@
* [`runPromisesInSeries`](#runpromisesinseries)
* [`sleep`](#sleep)
+### Logic
+* [`negate`](#negate)
+
### Math
* [`arrayAverage`](#arrayaverage)
* [`arraySum`](#arraysum)
@@ -170,10 +174,6 @@
* [`UUIDGenerator`](#uuidgenerator)
* [`validateNumber`](#validatenumber)
-### _Uncategorized_
-* [`detectDeviceType`](#detectdevicetype)
-* [`negate`](#negate)
-
## Adapter
### call
@@ -449,12 +449,12 @@ const dropElements = (arr, func) => {
### dropRight
-Returns a new array with `n` elements removed from the right
+Returns a new array with `n` elements removed from the right.
-Check if `n` is shorter than the given array and use `Array.slice()` to slice it accordingly or return an empty array.
+Use `Array.slice()` to slice the remove the specified number of elements from the right.
```js
-const dropRight = (arr, n = 1) => n < arr.length ? arr.slice(0, arr.length - n) : []
+const dropRight = (arr, n = 1) => arr.slice(0, -n);
//dropRight([1,2,3]) -> [1,2]
//dropRight([1,2,3], 2) -> [1]
//dropRight([1,2,3], 42) -> []
@@ -980,6 +980,20 @@ const currentURL = () => window.location.href;
[⬆ back to top](#table-of-contents)
+### detectDeviceType
+
+Detects wether the website is being opened in a mobile device or a desktop/laptop.
+
+Use a regular expression to test the `navigator.userAgent` property to figure out if the device is a mobile device or a desktop/laptop.
+
+```js
+const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? "Mobile" : "Desktop";
+// detectDeviceType() -> "Mobile"
+// detectDeviceType() -> "Desktop"
+```
+
+[⬆ back to top](#table-of-contents)
+
### elementIsVisibleInViewport
Returns `true` if the element specified is visible in the viewport, `false` otherwise.
@@ -1254,6 +1268,21 @@ async function sleepyWork() {
*/
```
+[⬆ back to top](#table-of-contents)
+## Logic
+
+### negate
+
+Negates a predicate function.
+
+Take a predicate function and apply `not` to it with its arguments.
+
+```js
+const negate = func => (...args) => !fun(...args);
+// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
+// negate(isOdd)(1) -> false
+```
+
[⬆ back to top](#table-of-contents)
## Math
@@ -2348,35 +2377,6 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) ==
// validateNumber('10') -> true
```
-[⬆ back to top](#table-of-contents)
-## _Uncategorized_
-
-### detectDeviceType
-
-Detects wether the website is being opened in a mobile device or a desktop/laptop.
-
-Use a regular expression to test the `navigator.userAgent` property to figure out if the device is a mobile device or a desktop/laptop.
-
-```js
-const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? "Mobile" : "Desktop";
-// detectDeviceType() -> "Mobile"
-// detectDeviceType() -> "Desktop"
-```
-
-[⬆ back to top](#table-of-contents)
-
-### negate
-
-Negates a predicate function.
-
-Take a predicate function and apply `not` to it with its arguments.
-
-```js
-const negate = func => (...args) => !fun(...args);
-// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
-// negate(isOdd)(1) -> false
-```
-
[⬆ back to top](#table-of-contents)
## Credits
diff --git a/docs/index.html b/docs/index.html
index e69391d07..9524d1f3f 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -130,6 +130,7 @@
arrayToHtmlList
bottomVisible
currentURL
+detectDeviceType
elementIsVisibleInViewport
getScrollPosition
getURLParameters
@@ -151,6 +152,9 @@
runPromisesInSeries
sleep
+
Logic
+
negate
+
Math
arrayAverage
arraySum
@@ -231,10 +235,6 @@
UUIDGenerator
validateNumber
-Uncategorized
-
detectDeviceType
-negate
-
Adapter
call
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
@@ -388,9 +388,9 @@ Returns the remaining elements.
// dropElements([1, 2, 3, 4], n => n >= 3) -> [3,4]
dropRight
-
Returns a new array with n elements removed from the right
-
Check if n is shorter than the given array and use Array.slice() to slice it accordingly or return an empty array.
-
const dropRight = (arr, n = 1) => n < arr.length ? arr.slice(0, arr.length - n) : []
+Returns a new array with n elements removed from the right.
+Use Array.slice() to slice the remove the specified number of elements from the right.
+const dropRight = (arr, n = 1) => arr.slice(0, -n);
//dropRight([1,2,3]) -> [1,2]
//dropRight([1,2,3], 2) -> [1]
//dropRight([1,2,3], 42) -> []
@@ -680,6 +680,13 @@ If lengths of the argument-arrays vary, undefined is used where no
const currentURL = () => window.location.href;
// currentUrl() -> 'https://google.com'
+
detectDeviceType
+
Detects wether the website is being opened in a mobile device or a desktop/laptop.
+
Use a regular expression to test the navigator.userAgent property to figure out if the device is a mobile device or a desktop/laptop.
+
const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? "Mobile" : "Desktop";
+// detectDeviceType() -> "Mobile"
+// detectDeviceType() -> "Desktop"
+
elementIsVisibleInViewport
Returns true if the element specified is visible in the viewport, false otherwise.
Use Element.getBoundingClientRect() and the window.inner(Width|Height) values
@@ -844,6 +851,14 @@ async function sleepyWork() {
}
*/
+
Logic
+negate
+
Negates a predicate function.
+
Take a predicate function and apply not to it with its arguments.
+
const negate = func => (...args) => !fun(...args);
+// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
+// negate(isOdd)(1) -> false
+
Math
arrayAverage
Returns the average of an array of numbers.
@@ -1464,21 +1479,6 @@ Use
Number() to check if the coercion holds.
const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n;
// validateNumber('10') -> true
-
Uncategorized
-detectDeviceType
-
Detects wether the website is being opened in a mobile device or a desktop/laptop.
-
Use a regular expression to test the navigator.userAgent property to figure out if the device is a mobile device or a desktop/laptop.
-
const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? "Mobile" : "Desktop";
-// detectDeviceType() -> "Mobile"
-// detectDeviceType() -> "Desktop"
-
-
negate
-
Negates a predicate function.
-
Take a predicate function and apply not to it with its arguments.
-
const negate = func => (...args) => !fun(...args);
-// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
-// negate(isOdd)(1) -> false
-