Pattern-match a result to a value with separate handlers for the two branches.
const display = match(result, { ok: (v) => `loaded ${v.length} bytes`, err: (e) => `failed: ${e}`,}); Copy
const display = match(result, { ok: (v) => `loaded ${v.length} bytes`, err: (e) => `failed: ${e}`,});
Pattern-match a result to a value with separate handlers for the two branches.