This repository has been archived by the owner. It is now read-only.

allow util.inspect (or other writer) to return null or undefined to signal no write (to bypass superfluous newline) #977

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
5 participants
@deanlandolt

When using a custom inspect method to control the console representation of a particular object there's currently no way to actually have it return nothing (including no newline). This is a tiny patch that lets the inspect method signal to write nothing by returning null or undefined. This is useful for custom console methods that, for instance, return a promise so that writing can be serialized. As it stands, obj.inspect = function() { return "" } is the best you can do, and that will still dump a newline to the write stream. With this patch you can do obj.inspect = function() {} to have an object disappear on the console, just as if undefined were returned.

@stbuehler

This comment has been minimized.

Show comment Hide comment
@stbuehler

stbuehler May 8, 2011

pull request contains unrelated commit

pull request contains unrelated commit

@trevnorris

This comment has been minimized.

Show comment Hide comment
@trevnorris

trevnorris Nov 15, 2012

Commit a7fd3ce could still be cherry-picked, but if no merge will happen unless superfluous commit 698b1da (which was already merged by @ry) is removed then recommend to be closed.

Commit a7fd3ce could still be cherry-picked, but if no merge will happen unless superfluous commit 698b1da (which was already merged by @ry) is removed then recommend to be closed.

@bnoordhuis

This comment has been minimized.

Show comment Hide comment
@bnoordhuis

bnoordhuis Nov 20, 2012

Member

This has been addressed in the master branch. Closing.

Member

bnoordhuis commented Nov 20, 2012

This has been addressed in the master branch. Closing.

@bnoordhuis bnoordhuis closed this Nov 20, 2012

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.