Update is.md

This commit is contained in:
atomiks
2018-04-12 15:20:50 +10:00
committed by GitHub
parent 85f9fab1be
commit 272d65bd2d

View File

@ -2,7 +2,7 @@
Checks if the provided value is of the specified type.
Ensure the value is not `undefined` or `null` and compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
Ensure the value is not `undefined` or `null` using `Array.includes()`, and compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
```js
const is = (type, val) => ![, null].includes(val) && val.constructor === type;