@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.
16 lines (15 loc) • 432 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var maybe_1 = require("./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 maybe_1.none;
}
result.push(item.orThrow());
}
return maybe_1.some(result);
}
exports.all = all;
;