cuducos/elm-format-number 4.0.1

Format numbers as pretty strings

Platform: Elm

Language: Elm

License: BSD-3-Clause

Repository: https://github.com/cuducos/elm-format-number

View on registry: http://package.elm-lang.org/packages/cuducos/elm-format-number/4.0.1

Direct download link: https://github.com/cuducos/elm-format-number/archive/4.0.1.zip

Install: elm-package install cuducos/elm-format-number 4.0.1


Elm Format Number Build Status

This simple Elm package formats float numbers as pretty strings:

import FormatNumber exposing (format)
import FormatNumber.Locales exposing (spanishLocale)

format spanishLocale (pi * 1000)  -- "3.141,59"

It is flexible enough to deal with different number of decimals, different thousand separators and diffetent decimal separator. It has a couple os predefined Locale but you can edit them or create your own:

import FormatNumber exposing (format)
import FormatNumber.Locales exposing (Locale)

myLocale : Locale
myLocale =
    { decimals = 4
    , thousandSeparator = " "
    , decimalSeparator = "."
    }
    
sharesLocale : Locale
sharesLocale = { myLocale | decimals = 3 }

format myLocale (pi * 1000) -- "3 141.5926"
format sharesLocale (pi * 1000) -- "3 141.593"


The API is further documented in package.elm-lang.org.

Tests

This package uses elm-doc-test, all the exemples in the documentation are automatically tested:

$ yarn install
$ yarn test
Sustain

Releases

4.0.1 May 04, 2017
4.0.0 February 25, 2017
3.0.0 February 12, 2017
2.0.0 December 28, 2016
1.0.0 December 17, 2016

Project Statistics

SourceRank 10
Dependencies 2
Dependent projects 0
Dependent repositories 1
Total releases 5
Latest release
First release
Stars 6
Forks 5
Watchers 1
Contributors 5
Repo Size: 60.5 KB

Top Contributors See all

Eduardo Cuducos Ophir LOJKINE Pedro Calderon Plínio Balduino Peter Gao

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2017-05-04 10:18:46 UTC

Login to resync this project