option-t
Version:
A toolkit of Nullable/Option/Result type implementation in ECMAScript. Their APIs are inspired by Rust's `Option<T>` and `Result<T, E>`.
25 lines (24 loc) • 727 B
JavaScript
export function isNotSameOkField(lhs, rhs) {
const ok = getOkFieldFromResultDirectly(lhs) !== getOkFieldFromResultDirectly(rhs);
return ok;
}
function getOkFieldFromResultDirectly(input) {
const val = input.ok;
return val;
}
export function isSameValField(lhs, rhs) {
const ok = getValFieldFromResultDirectly(lhs) === getValFieldFromResultDirectly(rhs);
return ok;
}
function getValFieldFromResultDirectly(input) {
const val = input.val;
return val;
}
export function isSameErrField(lhs, rhs) {
const ok = getErrFieldFromResultDirectly(lhs) === getErrFieldFromResultDirectly(rhs);
return ok;
}
function getErrFieldFromResultDirectly(input) {
const err = input.err;
return err;
}