elm/project-metadata-utils/1.0.0

NOTE: the latest version is 1.0.2

Elm.Package

Helpers for working with package name strings in elm.json files.

Packages

type Name

A guaranteed valid Elm package name.

String Conversions

toString : Name -> String

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

fromString : String -> Maybe Name

Try to convert a String into a Name:

fromString "elm/core"    == Just ...
fromString "elm/html"    == Just ...
fromString "tom/elm-css" == Just ...
fromString "tom/elm_css" == Nothing
fromString "tom/x.js"    == Nothing
fromString "elm"         == Nothing
fromString "html"        == Nothing

JSON Conversions

encode : Name -> Value

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

decoder : Decoder Name

Decode the module name strings that appear in elm.json