Skip to main content

Function: pickContactByEmail()

pickContactByEmail<T>(contacts, email): T | null

Defined in: src/lib/email/attribution.ts:8

Email → contact attribution (pure, no I/O).

Given a facility's contacts and a recipient address, pick the contact that address belongs to — case-insensitive, trimmed exact match. Extracted so the matching rule is unit-tested independently of the DB query that loads the contacts.

Type Parameters

T

T extends object

Parameters

contacts

T[]

email

string

Returns

T | null