Skip to content

Commit

Permalink
add json functions for better function names in js ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jan 15, 2024
1 parent 634a41b commit 167fae8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ISA/ISA.Json/ArcTypes/ArcAssay.fs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ module ArcAssay =
Assay.encoder (ConverterOptions()) (a.ToAssay())
|> Encode.toString 2

let toArcJsonString (a:ArcAssay) : string =
let spaces = 0
Encode.toString spaces (encoder a)

let fromArcJsonString (jsonString: string) =
match Decode.fromString decoder jsonString with
| Ok a -> a
| Error e -> failwithf "Error. Unable to parse json string to ArcAssay: %s" e

[<AutoOpen>]
module ArcAssayExtensions =

Expand Down
9 changes: 9 additions & 0 deletions src/ISA/ISA.Json/ArcTypes/ArcInvestigation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ module ArcInvestigation =
Investigation.encoder (ConverterOptions()) (a.ToInvestigation())
|> Encode.toString 2

let toArcJsonString (a:ArcInvestigation) : string =
let spaces = 0
Encode.toString spaces (encoder a)

let fromArcJsonString (jsonString: string) =
match Decode.fromString decoder jsonString with
| Ok a -> a
| Error e -> failwithf "Error. Unable to parse json string to ArcInvestigation: %s" e

[<AutoOpen>]
module ArcInvestigationExtensions =

Expand Down
9 changes: 9 additions & 0 deletions src/ISA/ISA.Json/ArcTypes/ArcStudy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ module ArcStudy =
Study.encoder (ConverterOptions()) (a.ToStudy(assays))
|> Encode.toString 2

let toArcJsonString (a:ArcStudy) : string =
let spaces = 0
Encode.toString spaces (encoder a)

let fromArcJsonString (jsonString: string) =
match Decode.fromString decoder jsonString with
| Ok a -> a
| Error e -> failwithf "Error. Unable to parse json string to ArcStudy: %s" e

[<AutoOpen>]
module ArcStudyExtensions =

Expand Down

0 comments on commit 167fae8

Please sign in to comment.