Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Library to use for result type of typescript functions and helper functions.
+Library to use for result type of typescript functions and helper functions.
npm i @mondopower/result-types
This library consists of two major result types.
@@ -9,4 +9,4 @@import {raiseFailure, raiseSuccess, Result} from '@mondopower/result-types'
enum FooErrorType {
someError= 'someError'
...
}
function foo(flag: boolean): Result<string, FooErrorType> {
if (flag)
return raiseFailure({
errorType: FooErrorType.someError,
message: '<my error message>'
})
return raiseSuccess('success-result')
}
const fooResponse = foo(flag)
if (fooResponse.isErrored)
// Failure Handling
else {
// success handling
const result = fooResponse.data
}
This library also includes some helper functions to manage success and failures which all can be found in the API documentation.
-Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc