diff options
author | Christopher Monsanto <chris@monsan.to> | 2015-06-10 04:25:04 -0400 |
---|---|---|
committer | Christopher Monsanto <chris@monsan.to> | 2015-08-08 00:13:52 -0400 |
commit | 7d14dd9b5e78faabb95d454a79faa513d0bbc2a5 (patch) | |
tree | af1eb85477c05a16b1cd4e7389f43689edd691b3 /src/res | |
parent | 6ad99ac1efe2a0c52f0652356dc397097b5d577c (diff) | |
download | android-node-v8-7d14dd9b5e78faabb95d454a79faa513d0bbc2a5.tar.gz android-node-v8-7d14dd9b5e78faabb95d454a79faa513d0bbc2a5.tar.bz2 android-node-v8-7d14dd9b5e78faabb95d454a79faa513d0bbc2a5.zip |
util: display constructor when inspecting objects
This commit modifies util.inspect(obj) to additionally show the name of
the function that constructed the object. This often reveals useful
information about the object's prototype. In other words, instead of
> new Cls
{}
we have
> new Cls
Cls {}
This also works with exotic objects:
> class ArrayCls extends Array {}
> new ArrayCls(1, 2, 3)
ArrayCls [ 1, 2, 3 ]
The names of "trivial" constructors like Object and Array are not shown,
unless there is a mismatch between the object representation and the
prototype:
> Object.create([])
Array {}
This feature is inspired by browser devtools.
PR-URL: https://github.com/nodejs/io.js/pull/1935
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'src/res')
0 files changed, 0 insertions, 0 deletions