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

12 lines (11 loc) 253 B
import { isNotUndefined } from '../core/undefinable.js'; /** * Return _b_ if _a_ is not `undefined`. * Otherwise, return _a_. */ export function andForUndefinable(a, b) { if (isNotUndefined(a)) { return b; } return undefined; }