Skip to content

Commit

Permalink
[Refactor] bail earlier when the value is falsy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 18, 2017
1 parent aa3ea0f commit a9e333e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -14,7 +14,7 @@ var regexClass = '[object RegExp]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';

module.exports = function isRegex(value) {
if (typeof value !== 'object') {
if (!value || typeof value !== 'object') {
return false;
}
return hasToStringTag ? tryRegexExecCall(value) : toStr.call(value) === regexClass;
Expand Down

0 comments on commit a9e333e

Please sign in to comment.