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. Only starts once the PR has an approving review. 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
@aduh95 aduh95 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jun 20, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@watilde watilde added the review wanted PRs that need review. label Jun 24, 2026
@panva panva removed the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Aug 31, 2026
@jasnell

jasnell commented Sep 8, 2026

Copy link
Copy Markdown
Member

@watilde ... if you still want to pursue this, can I ask you to rebase and resolve the conflicts?

@panva panva removed the review wanted PRs that need review. label Sep 9, 2026
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>
@watilde

watilde commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@jasnell Thanks for always sending reminders. I've performed a rebase.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (fd6682c) to head (c4de2f9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63984      +/-   ##
==========================================
+ Coverage   90.16%   90.18%   +0.02%     
==========================================
  Files         771      772       +1     
  Lines      265445   265506      +61     
  Branches    50455    50472      +17     
==========================================
+ Hits       239329   239451     +122     
+ Misses      17056    16990      -66     
- Partials     9060     9065       +5     
Files with missing lines Coverage Δ
lib/internal/console/constructor.js 97.84% <100.00%> (-0.35%) ⬇️
lib/internal/util/table.js 100.00% <100.00%> (ø)
lib/util.js 100.00% <100.00%> (ø)

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

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.

8 participants