{"id":13561306,"url":"https://github.com/cuducos/elm-format-number","last_synced_at":"2025-10-29T01:05:21.316Z","repository":{"id":45872196,"uuid":"76704698","full_name":"cuducos/elm-format-number","owner":"cuducos","description":"✨Format numbers as pretty strings","archived":false,"fork":false,"pushed_at":"2021-11-30T21:17:04.000Z","size":290,"stargazers_count":59,"open_issues_count":2,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-24T06:54:38.197Z","etag":null,"topics":["elm","format","hacktoberfest","i18n","numbers"],"latest_commit_sha":null,"homepage":"","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cuducos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["cuducos"]}},"created_at":"2016-12-17T04:55:58.000Z","updated_at":"2025-02-05T12:40:11.000Z","dependencies_parsed_at":"2022-09-14T12:01:18.632Z","dependency_job_id":null,"html_url":"https://github.com/cuducos/elm-format-number","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Felm-format-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Felm-format-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Felm-format-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Felm-format-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuducos","download_url":"https://codeload.github.com/cuducos/elm-format-number/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166215,"owners_count":21058475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","format","hacktoberfest","i18n","numbers"],"created_at":"2024-08-01T13:00:54.708Z","updated_at":"2025-10-29T01:05:21.248Z","avatar_url":"https://github.com/cuducos.png","language":"Elm","funding_links":["https://github.com/sponsors/cuducos"],"categories":["Elm"],"sub_categories":[],"readme":"# Elm Format Number ![Build](https://github.com/cuducos/elm-format-number/workflows/Build/badge.svg)\n\nThis simple [Elm](https://elm-lang.org) package formats `Float` numbers as pretty strings.\n\n## Format\n\nThe `format` function formats `Float` numbers using a locale with settings:\n\n```elm\nimport FormatNumber exposing (format)\nimport FormatNumber.Locales exposing (spanishLocale, usLocale)\n\nformat usLocale (pi * 1000)  --\u003e \"3,141.59\"\nformat spanishLocale (pi * 1000)  --\u003e \"3.141,593\"\n```\n\nIt is flexible enough to deal with different number of decimals, different thousand separators, different decimal separator, and different ways to represent negative numbers — all that is possible using `Locale`s. The `base` locale matches Elm's native `String.fromFloat` using unicode minus (`U+2212`) instead of an hyphen/dash.\n\n```elm\nimport FormatNumber exposing (format)\nimport FormatNumber.Locales exposing (Decimals(..), Locale, usLocale)\n\nsharesLocale : Locale\nsharesLocale =\n    { usLocale\n        | decimals = Exact 3\n        , negativePrefix = \"(\"\n        , negativeSuffix = \")\"\n    }\n\nformat usLocale -pi --\u003e \"−3.14\"\nformat sharesLocale -pi --\u003e \"(3.142)\"\n```\n\n### The `Decimals` strategy type\n\n`Decimals` type contains different strategies for handling the number of decimals when formatting the number.\n\n* `Min Int` shows at least a certain amount of decimal digits, adding trailing zeros if needed.\n* `Max Int` shows up to a certain amount of decimal digits, discarding trailing zeros if needed.\n* `Exact Int` shows an exact number of decimal digits, adding trailing zeros if needed.\n\n## Docs\n\nThe API is further documented in [package.elm-lang.org](http://package.elm-lang.org/packages/cuducos/elm-format-number/latest/FormatNumber).\n\n## Tests\n\nThis package uses [elm-verify-examples](https://www.npmjs.com/package/elm-verify-examples), all the examples in the documentation are automatically tested:\n\n```console\n$ npm install\n$ npm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuducos%2Felm-format-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuducos%2Felm-format-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuducos%2Felm-format-number/lists"}