From 1ad87e28671f3c4698f90df8fa418283e2471401 Mon Sep 17 00:00:00 2001 From: Khaled Al-Ansari Date: Thu, 5 Oct 2017 16:41:03 +0300 Subject: [PATCH] updating `is.boolean` method According to [this comment](https://github.com/sindresorhus/is/pull/12#issuecomment-334327363) comparing variable to boolean values `true` and `false` manually is faster than using `typeof` so I'm changing the function for a faster results --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b3d52b9..1eb118d 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,7 @@ is.undefined = isOfType('undefined'); is.null = x => x === null; is.string = isOfType('string'); is.number = isOfType('number'); -is.boolean = isOfType('boolean'); +is.boolean = (value) => value === true || value === false; is.symbol = isOfType('symbol'); is.array = Array.isArray;