From 729b901bc5b8da14819b48ce2877317f56eec36d Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Mon, 23 Dec 2019 13:53:54 +0200 Subject: [PATCH] typescript(option): refactor: .then(Some) looks better than async await Signed-off-by: prescientmoon --- typescript/option/src/helpers/mapAsync.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/typescript/option/src/helpers/mapAsync.ts b/typescript/option/src/helpers/mapAsync.ts index 05b8ea4..ebf7989 100644 --- a/typescript/option/src/helpers/mapAsync.ts +++ b/typescript/option/src/helpers/mapAsync.ts @@ -7,11 +7,7 @@ export const mapAsync = ( option: Option ) => { return match( - async value => { - const output = await mapper(value) - - return Some(output) - }, + value => mapper(value).then(Some), Promise.resolve(None), option )