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) 204 B
/** * Return _a_ if _a_ is not `null` and `undefined`. * Otherwise, return _b_. */ export function orForMaybe(a, b) { if (a !== undefined && a !== null) { return a; } return b; }