Skip to content

Commit e75bf9c

Browse files
committed
Better util.inspect shim
1 parent 9349075 commit e75bf9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/node/types.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ const vm = require('vm');
1010

1111
const objectEntries = require('object.entries');
1212

13+
function uncurryThis(f) {
14+
return f.call.bind(f);
15+
}
16+
17+
const ObjectToString = uncurryThis(Object.prototype.toString);
18+
1319
const inspect = value => {
1420
try {
1521
return JSON.stringify(value);
1622
} catch (e) {
17-
return `${typeof value}: ${value}`;
23+
return ObjectToString(value);
1824
}
1925
};
2026

0 commit comments

Comments
 (0)