joyent/node — pull request #1944 by TooTallNate (2011-10-26 07:02:02+00:00)
Title: More bulletproof `util.inspect()` function.

Use the *real* versions of the Date and RegExp functions, from the
prototype. This defends against code like:

``` js
var d = new Date()
d.toUTCString = null
util.inspect(d)
// TypeError: toUTCString is not a function
```

Or:

``` js
var r = /a regexp/
r.toString = null
util.inspect(r)
// TypeError: Cannot convert object to primitive value
```