Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjdestigter/elm-convert-units
Elm library for converting between quantities in different units.
https://github.com/rjdestigter/elm-convert-units
Last synced: 26 days ago
JSON representation
Elm library for converting between quantities in different units.
- Host: GitHub
- URL: https://github.com/rjdestigter/elm-convert-units
- Owner: rjdestigter
- License: bsd-3-clause
- Created: 2017-02-12T19:56:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-12T20:39:05.000Z (almost 8 years ago)
- Last Synced: 2024-10-19T03:25:14.785Z (3 months ago)
- Language: Elm
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-convert-units
Elm library for converting between quantities in different units. Inspired by https://github.com/ben-ng/convert-units# Usage
```
import ConvertUnits exposing (convert, describe, possibilities, isPossible)
import ConvertUnits.Definitions exposing (Category(Area), Descriptor)oneMeterToFoot : Result String Float
oneMeterToFoot = convert 1.0 "m" "ft"tenKgToOz : Result String Float
tenKgToOz = convert 10.0 "kg "oz"inches : Maybe Descriptor
inches = describe "in" // == { abbr: "in" , singluar: "Inch", plural: "Inches", toAnchor : (1 / 12) }canPixels : Bool
canPixels = isPossible "px" // == FalseareaUnits : List String
areaUnits = possibilities Area // == [ "mm2", "cm2", "m2", "ha", "km2", "in2", "ft2", "ac", "mi2" ]```