Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

TextUtils.getTable: accept headers[] as parameter #369

Closed
mheuzey opened this issue Mar 19, 2020 · 0 comments · Fixed by #572
Closed

TextUtils.getTable: accept headers[] as parameter #369

mheuzey opened this issue Mar 19, 2020 · 0 comments · Fixed by #572

Comments

@mheuzey
Copy link
Contributor

mheuzey commented Mar 19, 2020

I would like to pass an array of headers to TextUtils.getTable, in order to guarantee column order. Per the ECMAScript spec, properties are enumerated in the following order:

  1. Integer indices (if applicable), in ascending order.
  2. Other string keys (if applicable), in property creation order.
  3. Symbol keys (if applicable), in property creation order.

This means that in my table, if some of my column headers are simple numbers, they will get hoisted to the left of the table, since TextUtils.getTable builds the headers by calling Object.keys on the array of key-value pairs.

Another use case would be if I have built a full table of values, but don't always want to display the whole thing. By passing an array of headers, I can filter out which columns are displayed, if necessary.

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

Successfully merging a pull request may close this issue.

1 participant