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

16 lines (15 loc) 582 B
import { isNotUndefined } from '../core/undefinable.js'; /** * * Return _input_ directly. * * This value is passed as the input. But it maybe mutated by calling _effector_. * * Call _effector_ with _input_ if _input_ is not `undefined`. * * * This was added to sort with others or future enhancement to accept chaining functions. * We recommend to use simple `if` statement or similar way and they would be more efficient. */ export function inspectUndefinable(input, effector) { if (isNotUndefined(input)) { effector(input); } return input; }