import { asyncNullishChain } from "https://deno.land/x/froebel@v0.19.0/function.ts";
Same as nullishChain but accept asynchronous functions too.
Examples
Example 1
Example 1
const readFromCache = (id: string): Resource => { if (id in cache) return cache[id] }
const readFromFile = (id: string): Resource => { if (fileExists(id)) return readFile(id) }
const fetchFromNet = async (id: string): Promise<Resource> => await fetch(`someURL/${id}`)
// async (id: string) => Promise<Resource>
const getResource = asyncNullishChain(readFromCache, readFromFile, fetchFromNet)