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) 270 B
import { isUndefined } from '../core/undefinable.js'; /** * Return `null` if _input_ is `undfined`. * Otherwise, return `T` directly. */ export function toNullableFromUndefinable(input) { if (isUndefined(input)) { return null; } return input; }