diff --git a/README.md b/README.md index 640da6cd9..e6e38b36a 100644 --- a/README.md +++ b/README.md @@ -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`.