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.

8 lines (7 loc) 255 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var maybe_1 = require("./maybe"); function first(variants) { return variants.find(function (variant) { return !variant.isNone(); }) || maybe_1.none; } exports.first = first;