@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 13 lines 406 Bytes
Raw
1 import { Number, Option, Record, pipe } from "effect";
2 import * as Cookies from "effect/http/Cookies";
3
4 export const COUNT_COOKIE = "count";
5
6 export const readCountCookie = (cookieHeader: string): number =>
7 pipe(
8 Cookies.parseHeader(cookieHeader),
9 Record.get(COUNT_COOKIE),
10 Option.flatMap(Number.parse),
11 Option.filter(globalThis.Number.isSafeInteger),
12 Option.getOrElse(() => 0),
13 );