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

add option 'keys' to force ordering #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

r3mi
Copy link

@r3mi r3mi commented Mar 23, 2017

currently there is no way to force that lines are printed in a given order.
Specifically, Object.keys does not guarantee that keys are returned in insertion order (for example, on chrome and node, keys with numeric names e.g. '0' are returned first and in sort order).
This patch add a 'keys' option to force ordering

var data = {
  ferrets: 20,
  cats: 12,
  dogs: 30,
  koalas: 3
};
console.log(bars(data, { keys: ['cats', 'dogs', 'ferrets'] }));

@r3mi
Copy link
Author

r3mi commented Mar 23, 2017

PS : should I push this patch here, or on https://github.com/ben-ng/bars from @ben-ng , which is the source of the NPM package ?

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

Successfully merging this pull request may close these issues.

1 participant