diff --git a/docs/docs/dict.md b/docs/docs/dict.md index 539ae70..8385e12 100644 --- a/docs/docs/dict.md +++ b/docs/docs/dict.md @@ -39,3 +39,30 @@ Contrary to the TS bindings for `Object.values`, the types are refined. const index = Dict.values({ foo: 1, bar: 2, baz: 3 }); // [1, 2, 3]; ``` + +## Dict.fromOptional(dictOfOptions) + +Takes a dict whose values are `Option` and returns a dict containing only the values contained in `Some`. + +```ts title="Examples" +Dict.fromOptional({ + foo: Option.Some(1), + bar: Option.None(), + baz: Option.None(), +}); +// {foo: 1} + +Dict.fromOptional({ + foo: Option.Some(1), + bar: Option.Some(2), + baz: Option.None(), +}); +// {foo: 1, bar: 2} + +Dict.fromOptional({ + foo: Option.None(), + bar: Option.None(), + baz: Option.None(), +}); +// {} +```