Create a Result that contains an error.
Result.Err('error') // => { ok: false, error: 'error' }Result.Err() // => { ok: false, error: undefined } Copy
Result.Err('error') // => { ok: false, error: 'error' }Result.Err() // => { ok: false, error: undefined }
Check if a Result is an error.
Check if a Result is OK.
Check if a Result is an unknown error (error field is undefined).
Create a Result that contains a value.
Result.Ok(42) // => { ok: true, value: 42 }Result.Ok() // => { ok: true, value: undefined } Copy
Result.Ok(42) // => { ok: true, value: 42 }Result.Ok() // => { ok: true, value: undefined }
Create a Result that contains an error.