UNPKG

@sevinf/maybe

Version:

Maybe/Optional type implementation in Typescript. Main motivation for creating this library was handling `null` values in deeply nested data, coming from GraphQL APIs, but the library itself is not limited to GraphQL.

14 lines (13 loc) 340 B
import { none, some } from './maybe'; function all(maybies) { var result = []; for (var _i = 0, maybies_1 = maybies; _i < maybies_1.length; _i++) { var item = maybies_1[_i]; if (item.isNone()) { return none; } result.push(item.orThrow()); } return some(result); } export { all };