All files / lib Result.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 5/5
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201x   15x       1740x     1755x     14x       494x      
export class Result<V, E> {
    public static err<V, E>(error: E) {
        return new Result<V, E>(undefined, error);
    }
 
    public static ok<V, E>(value: V) {
        return new Result<V, E>(value);
    }
 
    constructor(readonly value?: V, readonly error?: E) {}
 
    public get isOk(): boolean {
        return this.value !== undefined;
    }
 
    public get isErr(): boolean {
        return this.error !== undefined;
    }
}