From 089ba6148fc16f2290026c083e557c7c71301a8b Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 26 Dec 2019 16:04:09 +0200 Subject: [PATCH] typescript(option): docs: wrote docs for the 'withDefault' helper Signed-off-by: prescientmoon --- typescript/option/src/helpers/withDefault.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/typescript/option/src/helpers/withDefault.ts b/typescript/option/src/helpers/withDefault.ts index b1c9934..ca855db 100644 --- a/typescript/option/src/helpers/withDefault.ts +++ b/typescript/option/src/helpers/withDefault.ts @@ -2,6 +2,12 @@ import { match } from './match' import { identity } from '@thi.ng/compose' import { Option } from '../types' +/** + * Provide a default value, turning an optional value into a normal value. + * + * @param _default The default value to use. + * @param option The option to get the default of. + */ export const withDefault = (_default: T, option: Option) => { return match(identity, _default, option) }