Add configurable granularity units, change ETA to estimate using this configuration #98
+72
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add option 'units', it is a map of unit labels to values (in seconds), e.g. { 's': 1, 'm': 60, 'h': 3600 }
Modify ETA estimation to return the least granular unit for which the eta is >= 1, based on supplied values
Add replacement token ':unit', returns the label associated with the unit value
ProgressBar.defaultUnits holds the h/m/s arrangement; it is not actually used by default to preserve compatibility
Example usage:
new ProgressBar(':eta:unit', { units: ProgressBar.defaultUnits });
Example output: '12.3m' -> '38.5s' (changes from minutes to seconds over time)
Addresses #63
I see there is already a pull request for this functionality; I implemented this before seeing that one, but this seems potentially more useful. Just go ahead and reject if this isn't what you want.