The node REPL has a built-in solution for overriding how objects are displayed, see here.
The REPL module internally uses
util.inspect()
, when printing values. However,util.inspect
delegates the call to the object'sinspect()
function, if it has one.