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

Make it possible to customize the arguments of formatNumber #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

philipgiuliani
Copy link

@philipgiuliani philipgiuliani commented Apr 20, 2016

In german we write "1,53 MB" instead of "1.53 MB". I have added the same arguments we have in formatNumber and i'm passing them.

I think for the next major version it would be the best to switch to an options object. That makes it very flexible and will not break the api in future releases in case we change something.

fileSize(fileSize, options = {}) {
    // assign default options
    options = Object.assign({ precision: 2, thousand: ".", decimal: "," }, options);

    // do the rest here
}

// call with:
Humanize.fileSize(1024, { decimal: "." });

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