Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Accept a new option, formatFunction, that converts numbers to strings #55

Merged
merged 2 commits into from
Jun 4, 2014
Merged

Accept a new option, formatFunction, that converts numbers to strings #55

merged 2 commits into from
Jun 4, 2014

Conversation

TrevorBurnham
Copy link
Contributor

This new option overrides the format option, providing increased flexibility, e.g. for applications that use locale-specific number formatting. formatFunction can be any map from numerical values to strings.

This overrides the "format" option, providing increased flexibility,
e.g. for applications that use locale-specific number formatting.
@ericrrichard
Copy link

Very cool. lgtm.

else
@addSpacer valueDigit
else
wholePart = not @format.precision or not fractionalPart(value) or false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not make sense to just make this the default formatFunction?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that would make perfect sense, but always having a formatFunction would require some refactoring elsewhere. I don't know this codebase, so I wanted to submit a minimal patch.

marcneuwirth added a commit that referenced this pull request Jun 4, 2014
Accept a new option, formatFunction, that converts numbers to strings
@marcneuwirth marcneuwirth merged commit 100634e into HubSpot:master Jun 4, 2014
@TrevorBurnham
Copy link
Contributor Author

Much obliged, Marc.

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 this pull request may close these issues.

4 participants