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) 281 B
import { andThenForResult } from './and_then.js'; function flatten(input) { return input; } /** * Converts from `Result<Result<T, E>, E>` to `Result<T, E>` */ export function flattenForResult(input) { const result = andThenForResult(input, flatten); return result; }