From 9b9e7aeee41f6e2209080558f644bdff6b9c9e62 Mon Sep 17 00:00:00 2001 From: Khaled Al-Ansari Date: Wed, 4 Oct 2017 20:18:00 +0300 Subject: [PATCH] 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 --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 045577f..1b4ead8 100644 --- a/index.js +++ b/index.js @@ -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';