Skip to content

Instantly share code, notes, and snippets.

@zwilias
Created April 27, 2017 11:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zwilias/27cdee22a945cd684c26bb1ab8bd0ea9 to your computer and use it in GitHub Desktop.
Save zwilias/27cdee22a945cd684c26bb1ab8bd0ea9 to your computer and use it in GitHub Desktop.
{- This is what the runtime passes in -}
type alias UnsafeFlags =
{ browser : Maybe String
, version : Maybe String
, randomSeed : Int
}
{- And this is what we want to work with -}
type alias Flags =
{ browser : String
, version : String
, randomSeed : Int
}
sanitizeFlags : UnsafeFlags -> Flags
sanitizeFlags unsafeFlags =
{ unsafeFlags
| browser = Maybe.withDefault "unknown" unsafeFlags.browser
, version = Maybe.withDefault "unknown" unsafeFlags.version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment