boolean can be detected with typeof

according to mdn `typeof` return string boolean for the boolean type (`true` and `false)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
This commit is contained in:
Khaled Al-Ansari 2017-10-04 20:18:00 +03:00 committed by GitHub
parent 27d15f40bd
commit 9b9e7aeee4

View file

@ -11,15 +11,15 @@ const is = value => {
return 'null';
}
if (value === true || value === false) {
return 'boolean';
}
const type = typeof value;
if (type === 'undefined') {
return 'undefined';
}
if (value === 'boolean') {
return 'boolean';
}
if (type === 'string') {
return 'string';