1
Fork 0

typescript(option): refactor: .then(Some) looks better than async await

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-23 13:53:54 +02:00 committed by prescientmoon
parent c56f734d82
commit 729b901bc5
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4

View file

@ -7,11 +7,7 @@ export const mapAsync = <T, U>(
option: Option<T>
) => {
return match(
async value => {
const output = await mapper(value)
return Some(output)
},
value => mapper(value).then(Some),
Promise.resolve(None),
option
)