Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing text-table formatting options to log.table() #65

Closed
sthzg opened this issue Jul 5, 2016 · 1 comment
Closed

Allow passing text-table formatting options to log.table() #65

sthzg opened this issue Jul 5, 2016 · 1 comment
Labels

Comments

@sthzg
Copy link

sthzg commented Jul 5, 2016

this.log.table() wraps table() provided by the text-table package. The second argument for text-table's table() would allow for passing alignment and separator options (docs).

Would you consider updating the method signature to allow passing formatting options along, e.g. like:

log.table = function (opts, fmt) {
  var tableData = [];

  opts = Array.isArray(opts) ? { rows: opts } : opts;
  opts.rows = opts.rows || [];

  fmt = fmt || {};

  opts.rows.forEach(function (row) {
    tableData.push(row);
  });

  return table(tableData, fmt);
};

On a related note, the docstring mentions that table is a wrapper around cli-table instead of text-table. Might have historical reasons?

@sthzg sthzg changed the title Allow passing text-table opts to this.log.table() Allow passing text-table formatting options to log.table() Jul 5, 2016
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2020

This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant