Allows converting between the different data structures provided by Folktale and JavaScript.
Allows converting between the different data structures provided by Folktale and JavaScript.
Converts a Future into a Promise.
Converts a Maybe
to an Result
. Nothing
s map to Error
s, Just
s map to
Ok
s.
Converts a Maybe
to a Validation
. Nothing
s map to Failure
s, Just
s map
to Success
es.
Converts a Promise to a folktale Future.
Converts a Promise-yielding function to a Task-yielding function.
Converts an Result
structure to a Maybe structure. Error
s map to Nothing
s,
Ok
s map to Just
s.
Converts an Result
to a Validation
. Error
s map to Failure
s, Ok
s map
to Success
es.
Converts a Validation
to a Maybe
. Failure
s map to Nothing
s,
Success
es map to Just
s.
Converts a Validation
to an Result
. Failure
s map to Error
s,
Success
es map to Ok
s.
Converts a function with a Node-style callback to a Task
.
Converts a nullable value to a maybe. null
and undefined
map to
Nothing
, any other value maps to Just
s.
Converts a nullable value to a Result
. null
and undefined
map to
Error
s, any other value maps to Ok
s.
Converts a nullable value to a Validation
. null
and undefined
map to Failure
s, any other type maps to Success
es.
{
resultToValidation: require('./result-to-validation'),
resultToMaybe: require('./result-to-maybe'),
validationToResult: require('./validation-to-result'),
validationToMaybe: require('./validation-to-maybe'),
maybeToValidation: require('./maybe-to-validation'),
maybeToResult: require('./maybe-to-result'),
nullableToValidation: require('./nullable-to-validation'),
nullableToResult: require('./nullable-to-result'),
nullableToMaybe: require('./nullable-to-maybe'),
nodebackToTask: require('./nodeback-to-task'),
futureToPromise: require('./future-to-promise'),
promiseToFuture: require('./promise-to-future'),
promisedToTask: require('./promised-to-task')
}