cuducos/elm-format-number 4.0.0

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.0

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

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


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

Dependencies Requirements Latest Stable Latest Release Licenses
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1 5.1.1 BSD-3-Clause
Explore the resolved dependency tree for cuducos/elm-format-number 4.0.0

Releases

  • 4.0.0 - February 25, 2017 01:01
  • 3.0.0 - February 12, 2017 01:01
  • 2.0.0 - December 28, 2016 01:00
  • 1.0.0 - December 17, 2016 04:57

Project Statistics

SourceRank 10
Dependencies 1
Dependent projects 0
Dependent repositories 1
Total releases 4
Latest release
First release
Stars 4
Forks 4
Watchers 1
Contributors 4
Repo Size: 42 KB

Top Contributors See all

Ophir LOJKINE Eduardo Cuducos Plínio Balduino Peter Gao

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2017-03-27 11:49:20 UTC