package.src.style-spec.util.result.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapbox-gl Show documentation
Show all versions of mapbox-gl Show documentation
A WebGL interactive maps library
The newest version!
// @flow
/**
* A type used for returning and propagating errors. The first element of the union
* represents success and contains a value, and the second represents an error and
* contains an error value.
* @private
*/
export type Result =
| {| result: 'success', value: T |}
| {| result: 'error', value: E |};
export function success(value: T): Result {
return {result: 'success', value};
}
export function error(value: E): Result {
return {result: 'error', value};
}