first-of.ts
This file
Path
apps/platform/src/sessions/first-of.ts
21 lines · 479 bytes · TypeScript
Last changed by
Merge build/comments-platform into mainoscabrielbefore adoptionddf09e8
History of this fileTake it
12345678910111213141516171819202122import { Effect, Option } from "effect";
import { Sessions } from "../sessions.ts";
export const firstOf = ( sessions: readonly Sessions["Service"][]): Sessions["Service"] => Sessions.of({ verify: (token) => Effect.gen(function* () { for (const { verify } of sessions) { const person = yield* verify(token);
if (Option.isSome(person)) { return person; } }
return Option.none(); }), });