All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.style-spec.util.result.js Maven / Gradle / Ivy

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};
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy