diff --git a/typescript/option/src/helpers.ts b/typescript/option/src/helpers.ts index fb87ce1..09a419f 100644 --- a/typescript/option/src/helpers.ts +++ b/typescript/option/src/helpers.ts @@ -105,3 +105,7 @@ export const flat = (option: Option): Option => { always(None) ) } + +export const fromNullable = (value: null | T): Option => { + return value === null ? None : Some(value) +}