From 01a96e887c9bb0de172d23135d2cf3644ab9e9fb Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 7 Oct 2014 16:50:37 +1100 Subject: [PATCH] types: use the idiomatic equivalents --- src/types.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types.js b/src/types.js index dfcde9f..257156b 100644 --- a/src/types.js +++ b/src/types.js @@ -2,7 +2,7 @@ module.exports = function enforce(type, value) { switch (type) { // http://jsperf.com/array-typecheck-2 case 'Array': { - if (value != null && value.constructor === Array) return + if (Array.isArray(value)) return break } @@ -25,7 +25,7 @@ module.exports = function enforce(type, value) { // http://jsperf.com/string-typecheck-2 case 'String': { - if (value != null && value.constructor === String) return + if (typeof value === 'string') return break }