types: use the idiomatic equivalents
This commit is contained in:
parent
0c380a063a
commit
01a96e887c
1 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,7 @@ module.exports = function enforce(type, value) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// http://jsperf.com/array-typecheck-2
|
// http://jsperf.com/array-typecheck-2
|
||||||
case 'Array': {
|
case 'Array': {
|
||||||
if (value != null && value.constructor === Array) return
|
if (Array.isArray(value)) return
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ module.exports = function enforce(type, value) {
|
||||||
|
|
||||||
// http://jsperf.com/string-typecheck-2
|
// http://jsperf.com/string-typecheck-2
|
||||||
case 'String': {
|
case 'String': {
|
||||||
if (value != null && value.constructor === String) return
|
if (typeof value === 'string') return
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue