update readme
This commit is contained in:
parent
ed6f17bcb2
commit
6bb7e2ffe5
1 changed files with 15 additions and 16 deletions
17
README.md
17
README.md
|
@ -24,12 +24,12 @@ class Recipient {
|
|||
registerDeserialize(Recipient, Recipient.deserialize)
|
||||
}
|
||||
|
||||
private readonly email: string
|
||||
readonly displayName: string
|
||||
private readonly email: string
|
||||
|
||||
constructor(email: string, displayName: string) {
|
||||
this.email = email
|
||||
constructor(displayName: string, email: string,) {
|
||||
this.displayName = displayName
|
||||
this.email = email
|
||||
}
|
||||
|
||||
static serialize<T>(serializer: ISerializer<T>, recipient: Recipient) {
|
||||
|
@ -109,23 +109,22 @@ const message = new Message(bob, [alice, alicesMom], 'i hope this email finds yo
|
|||
|
||||
const messageSerial = toString(message)
|
||||
console.log(messageSerial)
|
||||
// {"from":"bob@security.lol<Bob>","to":["alice@balloon.party<Alice>","alice.mom@malware.zip<Alice's Mom>"],"text":"i hope this email finds you before i do"}
|
||||
// {"from":"Bob<bob@security.lol>","to":["Alice<alice@balloon.party>","Alice's Mom<alice.mom@malware.zip>"],"text":"i hope this email finds you before i do"}
|
||||
|
||||
const messageDecereal = fromString(messageSerial, Message)
|
||||
console.log(messageDecereal)
|
||||
/*
|
||||
Message {
|
||||
from: Recipient { email: 'bob@security.lol', displayName: 'Bob' },
|
||||
from: Recipient { displayName: 'Bob', email: 'bob@security.lol' },
|
||||
to: [
|
||||
Recipient { email: 'alice@balloon.party', displayName: 'Alice' },
|
||||
Recipient { displayName: 'Alice', email: 'alice@balloon.party' },
|
||||
Recipient {
|
||||
email: 'alice.mom@malware.zip',
|
||||
displayName: "Alice's Mom"
|
||||
displayName: "Alice's Mom",
|
||||
email: 'alice.mom@malware.zip'
|
||||
}
|
||||
],
|
||||
text: 'i hope this email finds you before i do'
|
||||
}
|
||||
*/
|
||||
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue