diff --git a/typescript/option/src/helpers/bindAsync.ts b/typescript/option/src/helpers/bindAsync.ts new file mode 100644 index 0000000..30f8955 --- /dev/null +++ b/typescript/option/src/helpers/bindAsync.ts @@ -0,0 +1,10 @@ +import { Mapper } from '../internalTypes' +import { Option, None } from '../types' +import { match } from './match' + +export const bindAsync = ( + binder: Mapper>>, + option: Option +): Promise> => { + return match(binder, Promise.resolve(None), option) +} diff --git a/typescript/option/src/helpers/external.ts b/typescript/option/src/helpers/external.ts index 408312a..25ca3d8 100644 --- a/typescript/option/src/helpers/external.ts +++ b/typescript/option/src/helpers/external.ts @@ -17,3 +17,4 @@ export * from './toArray' export * from './toNullable' export * from './withDefault' export * from './mapAsync' +export * from './bindAsync'