EmailWithName
A mailbox (RFC 5322): an address with the name shown with it, written Ada Lovelace <ada@example.com>.
A mailbox (RFC 5322): an address with the name shown with it, written Ada Lovelace <ada@example.com>. Personal data.
People and contact; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, EmailWithName { address: ... }.
text.parse(raw, as: EmailWithName) reads one from its text; text that isn't one at all fails malformed, such as Mary Somerville, <mary@example.com> or Mary Somerville <mary>.
Fields
| Field | Type |
|---|---|
name |
Text? |
address |
Email |
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends an object of its parts.
| Text | JSON |
|---|---|
Mary Somerville <mary@example.com> |
{"name":"Mary Somerville","address":"mary@example.com"} |
"Somerville, Mary" <mary@example.com> |
{"name":"Somerville, Mary","address":"mary@example.com"} |
mary@example.com |
{"name":null,"address":"mary@example.com"} |
It is stored in 2 columns, each named for the field, _ and its suffix. This is "Somerville, Mary" <mary@example.com>:
| Column | Type | Holds |
|---|---|---|
<field>_name |
text |
'Somerville, Mary' |
<field>_address |
text |
'mary@example.com' |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
Mary Somerville <mary@example.com> |
Mary Somerville <mary@example.com> |
"Somerville, Mary" <mary@example.com> |
"Somerville, Mary" <mary@example.com> |
mary@example.com |
mary@example.com |
Operations
It has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-email-with-name.md.Built from Jadpo main at e00e61f.