Skip to content

Commit

Permalink
[Fix] properly handle callable regexes in older engines
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 21, 2022
1 parent 07f868c commit 848fe48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
return inspect_(value, opts, depth + 1, seen);
}

if (typeof obj === 'function') {
if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
var name = nameOf(obj);
var keys = arrObjKeys(obj, inspect);
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
Expand Down

0 comments on commit 848fe48

Please sign in to comment.