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 support for human friendly abbreviations on large numbers #7

Merged
merged 1 commit into from
Sep 24, 2012

Conversation

aaaaron
Copy link
Contributor

@aaaaron aaaaron commented Sep 23, 2012

My project was dealing with very large numbers, and the text values were overflowing the arc. This fork adds two new options:

    // humanFriendly : bool
    // convert large numbers for min, max, value to human friendly (e.g. 1234567 -> 1.23M)
    humanFriendly : (config.humanFriendly) ? config.humanFriendly : false,

    // humanFriendlyDecimal : int
    // number of decimal places for our human friendly number to contain
    humanFriendlyDecimal : (config.humanFriendlyDecimal) ? config.humanFriendlyDecimal : 0,

Here's an example of what it looks like in use: http://i.imgur.com/jDEnT.png

The actual code to do the conversion was extracted from http://stackoverflow.com/questions/2692323/code-golf-friendly-number-abbreviator and made to be a bit easier to read.

…ted by two new config options: humanFriendly (bool), humanFriendlyDecimal (int)
toorshia added a commit that referenced this pull request Sep 24, 2012
Add support for human friendly abbreviations on large numbers
@toorshia toorshia merged commit f6ba9f0 into toorshia:master Sep 24, 2012
@toorshia
Copy link
Owner

Hey aaaaron, this is great! I did some quick testing, works like a charm. Thanks for the effort, I'll make sure your name finds its way into credits once I finally find the time to update the site and download package :)

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

Successfully merging this pull request may close these issues.

2 participants