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) 263 B
import { isNull } from '../core/nullable.js'; /** * Return `undefined` if _input_ is `null`. * Otherwise, return `T` directly. */ export function toUndefinableFromNullable(input) { if (isNull(input)) { return undefined; } return input; }