IBM / report-toolkit

A toolkit for consumers of Node.js diagnostic Reports
https://ibm.github.io/report-toolkit
Other
84 stars 10 forks source link

sorting output should be done in the CLI #19

Open boneskull opened 5 years ago

boneskull commented 5 years ago

Currently, sorting is done in the core API (toReportFromObject), which doesn't make a lot of sense:

  1. sorting must concatenate the stream to an array, which means there's a bottleneck
  2. internally, sorting does not matter
  3. sorting the output only has any bearing on the order of messages output by the inspector
  4. thus, sorting should be done JIT, which would be JUST BEFORE the formatter gets the data
  5. and this should happen in the CLI
boneskull commented 5 years ago

also, IMO sorting is out-of-scope for non-CLI usage

boneskull commented 4 years ago

to do this, you'd need to pull any sort-related anything out of the inspect fn in core/src/observable.js and make it part of the stream in cli/src/commands/inspect.js. there's a sort() in common/src/observable.js helper fn that may help. if it's not used, remove it.