types: use the idiomatic equivalents

This commit is contained in:
Daniel Cousens 2014-10-07 16:50:37 +11:00
parent 0c380a063a
commit 01a96e887c

View file

@ -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
}