1
0
dust/examples/option.ds
2023-12-26 20:05:19 -05:00

23 lines
356 B
Plaintext

create_user = (fn email <str>, name <option(str)>) <map> {
{
email = email
username = (either_or name email)
}
}
(assert_equal
{
email = "bob@example.com"
username = "bob"
},
(create_user "bob@example.com" some("bob"))
)
(assert_equal
{
email = "sue@example.com"
username = "sue@example.com"
},
(create_user "sue@example.com" none)
)