basefp
For those who want to stay small and nimble
Inspired by https://medium.com/javascript-inside/effective-data-validation-in-javascript-5c2f3e75249e
API
moduleexports = asyncPipe // asyncPipe :: Foldable f => f (a -> Promise) -> a -> Promise a Error pipe // pipe :: Foldable f => f (Any -> Any) -> a -> b compose // compose :: (b -> c) -> (a -> b) -> (a -> c) map // map :: Functor f => (a -> b) -> f a -> f b filter // filter :: Filterable f => (a -> Boolean) -> f a -> f a reduce // reduce :: Foldable f => (b, a -> b) -> b -> f a -> b encase // encase :: DefaultValue -> (a -> b) -> DefaultValue || b log // log :: a -> IO a recover // recover :: DefaultValue -> a -> DefaultValue || a
Example
const user = name: "Dimitri" cities: "Berlin" "Stuttgart" const pipeline = user console // "S"