simple-result v0.1.7
Simple Result
Yet another Result
type, inspired by Rust. This type allows you to encode a
logical success or failure when it still may be useful to return a value.
For example, in some string parsing situations, it is useful to be able to parse from a list of options. In this case, a success would mean that the parsed string was one of the options, whereas a failure would imply that it wasn't. In this case, the parsed string could still be returned, such as to construct a more specific error message.
This package is part of the
mcfunction-langserver
project. It
is published automatically - see
the publishing strategy.
Example
import { Ok, Err, Result } from "simple-result";
import * as assert from "assert";
const value = Ok("Hello");
assert(isOk(value));
assert(!isErr(value));
function parse_from_option(
parser: Parser,
options: string[]
): Result<string, string | undefined>;
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago