Rest ...results: ResultsResults to combine
A Result that holds a tuple of successes or a single failure
Combines multiple functions that have 0-1 arguments return Results into single one that takes
an array of arguments
Rest ...results: ResultsFunctions that return Results to combine
A Function that takes an array of arguments and returns a Result that holds
a tuple of successes or a single failure. If all combined functions have zero arguments
resulting function also will take zero arguments instead of an array of undefined values
Readonly failure: (<Failure>(failure) => FailureResult<Failure>)A failure, storing a Failure value.
Returns a function that takes a new result, mapping any success value using the given transformation and unwrapping the produced result.
A function that takes a success value of the result.
A function that takes a Result value with the result of evaluating transform as
the new failure value if result represents a failure.
Returns a function that takes a new result, mapping any success value using the given transformation and unwrapping the produced result.
A function that takes a success value of the result.
A function that takes a Result value with the result of evaluating transform as
the new failure value if result represents a failure.
Returns a new result, mapping any success value using the given transformation and unwrapping the produced result.
A function that takes a success value of the result and returns another Result.
Original Result.
A Result value with the result of evaluating transform as the new failure value if
result represents a failure.
Returns a new result, mapping any success value using the given transformation and unwrapping the produced result.
A Result value with the result of evaluating transform as the new failure value if
result represents a failure.
Returns a function that takes a new result, mapping any failure value using the given transformation and unwrapping the produced result.
A function that takes the failure value of the result.
A function that takes a Result value, either from the function or
the previous success.
Returns a function that takes a new result, mapping any failure value using the given transformation and unwrapping the produced result.
A function that takes the failure value of the result.
A function that takes a Result value, either from the function or
the previous success.
Returns a new result, mapping any failure value using the given transformation and unwrapping the produced result.
A function that takes the failure value of the result.
Original Result.
A Result value, either from the function or the previous success.
Returns a new result, mapping any failure value using the given transformation and unwrapping the produced result.
A Result value, either from the function or the previous success.
Returns a function that takes a new result, mapping any success value using the given transformation.
Use this method when you need to transform the value of a Result
value when it represents a success. The following example transforms
the number success value of a result into a string:
function getNextNumber(): Result<number, Error> { ... }
const numberResult = getNextNumber()
// numberResult == Result.success(5)
const stringResult = Result.map((value) => `${value}`)(numberResult)
// stringResult == Result.success('5')
A function that takes the success value of result.
A function that takes a Result value with the result of evaluating transform as
the new success value if result represents a success.
Returns a function that takes a new result, mapping any success value using the given transformation.
Use this method when you need to transform the value of a Result
value when it represents a success. The following example transforms
the number success value of a result into a string:
function getNextNumber(): Result<number, Error> { ... }
const numberResult = getNextNumber()
// numberResult == Result.success(5)
const stringResult = Result.map((value) => `${value}`)(numberResult)
// stringResult == Result.success('5')
A function that takes the success value of result.
A function that takes a Result value with the result of evaluating transform as
the new success value if result represents a success.
Returns a new result, mapping any success value using the given transformation.
Use this method when you need to transform the value of a Result
value when it represents a success. The following example transforms
the number success value of a result into a string:
function getNextNumber(): Result<number, Error> { ... }
const numberResult = getNextNumber()
// numberResult == Result.success(5)
const stringResult = Result.map((value) => `${value}`, numberResult)
// stringResult == Result.success('5')
A function that takes the success value of result.
Original Result.
A Result value with the result of evaluating transform as the new success value if
result represents a success.
Returns a new result, mapping any success value using the given transformation.
A function that takes the success value of result.
Original Result.
A Result value with the result of evaluating transform as the new success value if
result represents a success.
Returns a function that takes a result, mapping any failure value using the given transformation.
Use this method when you need to transform the value of a Result
value when it represents a failure. The following example transforms
the error value of a result by wrapping it in a custom Error type:
class DatedError extends Error {
readonly date: Date = new Date()
}
const result: Result<number, Error> = // ...
// result == Result.failure(<error value>)
const resultWithDatedError = Result.mapError((value) => new DatedError(value.message))(result)
// result == Result.failure(DatedError(date: <date>))
A function that takes the failure value of the result.
A function that takes Result value with the result of evaluating transform as
the new failure value if result represents a failure.
Returns a function that takes a result, mapping any failure value using the given transformation.
Use this method when you need to transform the value of a Result
value when it represents a failure. The following example transforms
the error value of a result by wrapping it in a custom Error type:
class DatedError extends Error {
readonly date: Date = new Date()
}
const result: Result<number, Error> = // ...
// result == Result.failure(<error value>)
const resultWithDatedError = Result.mapError((value) => new DatedError(value.message))(result)
// result == Result.failure(DatedError(date: <date>))
A function that takes the failure value of the result.
A function that takes Result value with the result of evaluating transform as
the new failure value if result represents a failure.
Returns a new result, mapping any failure value using the given transformation.
Use this method when you need to transform the value of a Result
value when it represents a failure. The following example transforms
the error value of a result by wrapping it in a custom Error type:
class DatedError extends Error {
readonly date: Date = new Date()
}
const result: Result<number, Error> = // ...
// result == Result.failure(<error value>)
const resultWithDatedError = Result.mapError((value) => new DatedError(value.message), result)
// result == Result.failure(DatedError(date: <date>))
A function that takes the failure value of the result.
Original Result.
A Result value with the result of evaluating transform as the new failure value if
result represents a failure.
Returns a new result, mapping any failure value using the given transformation.
A function that takes the failure value of the result.
Original Result.
A Result value with the result of evaluating transform as the new failure value if
result represents a failure.
Unwraps result and transforms success and failure values or returns a default value if needed transform is not provided
Success & failure transformers and default value
A function that takes a Result and returns transformed wrapped value or default value
Unwraps result and transforms success and failure values or returns a default value if needed transform is not provided
Success & failure transformers and default value
A Result to unwrap
Transformed wrapped value or default value
Unwraps result and transforms success and failure values or returns a default value if needed transform is not provided
Additional siganture for generic results
Success & failure transformers and default value
A Result to unwrap
Transformed wrapped value or default value
Unwraps result and transforms success and failure values or returns a default value if needed transform is not provided
Additional siganture for generic results
Success & failure transformers and default value
A function that takes a Result and returns transformed wrapped value or default value
Readonly success: (<Success>(success) => SuccessResult<Success>)A success, storing a Success value.
Generated using TypeDoc
Combines multiple
Results into single one