Skip to content

Commit

Permalink
+ ValueOption.ofOption
Browse files Browse the repository at this point in the history
  • Loading branch information
gusty committed Oct 6, 2023
1 parent c1ebe74 commit 1aa0154
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/FSharpPlus/Extensions/ValueOption.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ module ValueOption =
| true, x -> ValueSome x
| false, _ -> ValueNone

let toOption x =
match x with
/// <summary>Converts a ValueOption to an Option.</summary>
let toOption (source: ValueOption<'T>) =
match source with
| ValueSome x -> Some x
| ValueNone -> None

/// <summary>Converts an Option to a ValueOption.</summary>
let ofOption (source: option<'T>) =
match source with
| Some x -> ValueSome x
| None -> ValueNone

0 comments on commit 1aa0154

Please sign in to comment.