Add Envelope function to extract settings values
parent
f910c0225b
commit
5293eb4003
|
@ -1,7 +1,7 @@
|
||||||
module Internal.Values.Envelope exposing
|
module Internal.Values.Envelope exposing
|
||||||
( Envelope, init
|
( Envelope, init
|
||||||
, map, mapMaybe
|
, map, mapMaybe
|
||||||
, Settings, mapSettings
|
, Settings, mapSettings, extractSettings
|
||||||
, getContent, extract
|
, getContent, extract
|
||||||
, encode, decoder
|
, encode, decoder
|
||||||
)
|
)
|
||||||
|
@ -22,7 +22,7 @@ settings that can be adjusted manually.
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
@docs Settings, mapSettings
|
@docs Settings, mapSettings, extractSettings
|
||||||
|
|
||||||
|
|
||||||
## Extract
|
## Extract
|
||||||
|
@ -149,6 +149,16 @@ extract f (Envelope data) =
|
||||||
f data.content
|
f data.content
|
||||||
|
|
||||||
|
|
||||||
|
{-| Map a function on the settings, effectively getting data that way.
|
||||||
|
|
||||||
|
This can be helpful if you have a UI that displays custom settings to a user.
|
||||||
|
|
||||||
|
-}
|
||||||
|
extractSettings : (Settings -> b) -> Envelope a -> b
|
||||||
|
extractSettings f (Envelope data) =
|
||||||
|
f data.settings
|
||||||
|
|
||||||
|
|
||||||
{-| Get the original item that is stored inside an Envelope.
|
{-| Get the original item that is stored inside an Envelope.
|
||||||
|
|
||||||
Make sure that you're only using this if you're interested in the actual value!
|
Make sure that you're only using this if you're interested in the actual value!
|
||||||
|
|
Loading…
Reference in New Issue