Skip to content

util: add util.table()#63984

Open
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:util-table
Open

util: add util.table()#63984
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:util-table

Conversation

@watilde

@watilde watilde commented Jun 18, 2026

Copy link
Copy Markdown
Member

Add util.table(tabularData[, properties][, options]), which renders tabular data with the same layout as console.table but returns it as a string instead of writing to a stream. This is useful for logging, writing to a file, or building output without a console.

The row-building logic is extracted from console.table into a shared internal module so both APIs produce identical output.

@nodejs-github-bot nodejs-github-bot added console Issues and PRs related to the console subsystem. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Jun 18, 2026
@TheOneTheOnlyJJ

Copy link
Copy Markdown
Contributor

Would this be a lot faster if the shared helper were implemented in C++?

Comment thread lib/internal/util/table.js Outdated
Comment thread lib/internal/util/table.js Outdated
@watilde watilde requested a review from ljharb June 19, 2026 14:14
@Renegade334 Renegade334 added the semver-minor PRs that contain new features and should be released in the next minor version. label Jun 19, 2026
@watilde watilde added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 20, 2026
@watilde watilde requested a review from aduh95 June 20, 2026 07:19
Comment thread lib/internal/util/table.js
Comment thread lib/internal/util/table.js Outdated
Add `util.table(tabularData[, properties][, options])`, which renders
tabular data with the same layout as `console.table` but returns it as
a string instead of writing to a stream. This is useful for logging,
writing to a file, or building output without a console.

The row-building logic is extracted from `console.table` into a shared
internal module so both APIs produce identical output.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 20, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. console Issues and PRs related to the console subsystem. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants