eco-pro/project-metadata-utils/1.0.0

Rerouted (archive, verified). The original repository is gone. This copy comes from an archive (Software Heritage). The Lamdera package server serves a copy recovered from swh:1:rev:ccedc9b26200893c07fe8295a6a061cb4d4b8e7f (Software Heritage, origin https://github.com/eco-pro/project-metadata-utils).

What we checked: Software Heritage archived tag 1.0.0 of github.com/eco-pro/project-metadata-utils at commit ccedc9b26200; its commit ccedc9b26200 is from 2021-02-20 17:08 UTC, before the version was published (2021-02-20 17:14 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, made from Software Heritage's copy of the files Elm uses, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/eco-pro/project-metadata-utils/zipball/1.0.0/

Elm.Version

Helpers for working with version strings in elm.json files.

Versions

type Version

A guaranteed valid Elm version. All versions are 1.0.0 or greater.

Version 1.0.0 for easy access.

compare : Version -> Version -> Order

Compare two versions:

v1 = fromString "1.0.0"
v2 = fromString "2.0.0"
v3 = fromString "3.0.0"


-- Maybe.map2 compare v1 v2 == Just LT
-- Maybe.map2 compare v2 v2 == Just EQ
-- Maybe.map2 compare v2 v1 == Just GT

String Conversions

toString : Version -> String

Convert a Version to a String that works in elm.json

toString one == "1.0.0"
fromString : String -> Maybe Version

Try to convert a String into a Version. The major, minor, and patch numbers must all appear separated by dots:

fromString "1.0.0" == Just one
fromString "2.0.0" == Just ...
fromString "3-0-0" == Nothing
fromString "3.0"   == Nothing

JSON Conversions

encode : Version -> Value

Turn a Version into a string for use in elm.json

decoder : Decoder Version

Decode the version strings that appear in elm.json

Tuple Conversions

toTuple : Version -> ( Int, Int, Int )

Turn a Version into a tuple to extract the numbers as integers.

toTuple one == (1, 0, 0)


Maybe.map toTuple (fromString "2.0.4" ) == Just (2, 0, 4)
Maybe.map toTuple (fromString "7.3.10") == Just (7, 3, 10)
fromTuple : ( Int, Int, Int ) -> Maybe Version

Try to make a Version from given numbers. This way you do not need to turn things into strings for no reason. It can still fail if you give negative numbers or versions below 1.0.0:

fromTuple (1, 0, 0) == Just one
fromTuple (2, 0, 1) == Just ...
fromTuple (0, 0, 1) == Nothing