diff --git a/src/Internal/Values/Envelope.elm b/src/Internal/Values/Envelope.elm index ba60a6b..4f9a13b 100644 --- a/src/Internal/Values/Envelope.elm +++ b/src/Internal/Values/Envelope.elm @@ -1,7 +1,7 @@ module Internal.Values.Envelope exposing ( Envelope, init , map, mapMaybe - , Settings, mapSettings + , Settings, mapSettings, extractSettings , getContent, extract , encode, decoder ) @@ -22,7 +22,7 @@ settings that can be adjusted manually. ## Settings -@docs Settings, mapSettings +@docs Settings, mapSettings, extractSettings ## Extract @@ -149,6 +149,16 @@ extract f (Envelope data) = 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. Make sure that you're only using this if you're interested in the actual value!