Added getType function
This commit is contained in:
@ -261,6 +261,15 @@ const arrayMin = arr => Math.min(...arr);
|
||||
// arrayMin([10, 1, 5]) -> 1
|
||||
```
|
||||
|
||||
### Get native type of value
|
||||
|
||||
Returns lower-cased constructor name of value, "undefined" or "null" if value is undefined or null
|
||||
|
||||
```js
|
||||
const getType = v => v === undefined ? "undefined" : v === null ? "null" : v.constructor.name.toLowerCase();
|
||||
// getType(new Set([1,2,3])) -> "set"
|
||||
```
|
||||
|
||||
### Get scroll position
|
||||
|
||||
Use `pageXOffset` and `pageYOffset` if they are defined, otherwise `scrollLeft` and `scrollTop`.
|
||||
|
||||
Reference in New Issue
Block a user