Skip to content

Commit 01a96e8

Browse files
committed
types: use the idiomatic equivalents
1 parent 0c380a0 commit 01a96e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = function enforce(type, value) {
22
switch (type) {
33
// http://jsperf.com/array-typecheck-2
44
case 'Array': {
5-
if (value != null && value.constructor === Array) return
5+
if (Array.isArray(value)) return
66
break
77
}
88

@@ -25,7 +25,7 @@ module.exports = function enforce(type, value) {
2525

2626
// http://jsperf.com/string-typecheck-2
2727
case 'String': {
28-
if (value != null && value.constructor === String) return
28+
if (typeof value === 'string') return
2929
break
3030
}
3131

0 commit comments

Comments
 (0)