Skip to content

Commit a9e333e

Browse files
committed
[Refactor] bail earlier when the value is falsy.
1 parent aa3ea0f commit a9e333e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var regexClass = '[object RegExp]';
1414
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
1515

1616
module.exports = function isRegex(value) {
17-
if (typeof value !== 'object') {
17+
if (!value || typeof value !== 'object') {
1818
return false;
1919
}
2020
return hasToStringTag ? tryRegexExecCall(value) : toStr.call(value) === regexClass;

0 commit comments

Comments
 (0)