Skip to content

Commit 848fe48

Browse files
committed
[Fix] properly handle callable regexes in older engines
1 parent 07f868c commit 848fe48

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
156156
return inspect_(value, opts, depth + 1, seen);
157157
}
158158

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

0 commit comments

Comments
 (0)