-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicroUtilsWrapper.fs
More file actions
25 lines (19 loc) · 911 Bytes
/
Copy pathMicroUtilsWrapper.fs
File metadata and controls
25 lines (19 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module MicroUtils.Interop
open MicroUtils
type MicroOption<'a> = Types.Optional<'a>
#nowarn "3391"
let toOption (value : MicroOption<'a>) : Option<'a> = if value.HasValue then Some value.Value else None
// let toMicroOption (value : Option<'a>) : MicroOption<'a> = value
// let toOption (microOption : Functional.Option<_>) = if microOption.IsSome then Some microOption.Value else None
// let toMicroOption = function Some value -> Functional.Option<_>.Some(value) | None -> Functional.Option<_>.None
[<RequireQualifiedAccess>]
module TypeTreeObject =
open MicroUtils.UnityFilesystem
let tryGetField<'a> fieldName (tto : ITypeTreeObject) : 'a option =
tto.TryGetField<'a>(fieldName)
|> toOption
|> Option.map (fun f -> f.Invoke())
let toMap (tto : ITypeTreeObject) =
tto.ToDictionary()
|> Seq.map (fun pair -> pair.Key, pair.Value)
|> Map.ofSeq