UNPKG

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>`.

11 lines (10 loc) 164 B
/** * Return _b_ if _a_ is `Some(T)`. * Otherwise, return _a_. */ export function andForOption(a, b) { if (a.ok) { return b; } return a; }