import { firstNotNullishOf } from "https://deno.land/std@0.139.0/collections/mod.ts";
Applies the given selector to elements in the given array until a value is produced that is neither null
nor undefined
and returns that value
Returns undefined
if no such value is produced
Example:
import { firstNotNullishOf } from "https://deno.land/std@0.139.0/collections/mod.ts";
import { assertEquals } from "https://deno.land/std@0.139.0/testing/asserts.ts";
const tables = [
{ number: 11, order: null },
{ number: 12, order: 'Soup' },
{ number: 13, order: 'Salad' },
]
const nextOrder = firstNotNullishOf(tables, it => it.order)
assertEquals(nextOrder, 'Soup')