Skip to content

Commit

Permalink
Merge pull request #366 from Thorium/dict-lookups-reduction
Browse files Browse the repository at this point in the history
Minor code clean-up: Avoid dictionary double-lookups.
  • Loading branch information
Zaid-Ajaj authored Jul 11, 2024
2 parents 76a1ebd + 727e2ae commit f622ea2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Fable.Remoting.Json/FableConverter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,10 @@ type FableJsonConverter() =
| true, Kind.MutableRecord ->
let content = serializer.Deserialize<JObject> reader
let fields = t.GetProperties() |> Array.map (fun property ->
if content.ContainsKey property.Name then
content[property.Name].ToObject(property.PropertyType, serializer)
else
match content.TryGetValue property.Name with
| true, contentProp ->
contentProp.ToObject(property.PropertyType, serializer)
| false, _ ->
null
)

Expand Down
7 changes: 4 additions & 3 deletions build/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,11 @@ createTarget "IntegrationTestsLive" <| fun _ ->
run clientUITests "dotnet" "run"

let runTarget targetName =
if targets.ContainsKey targetName then
match targets.TryGetValue targetName with
| true, target ->
let input = Unchecked.defaultof<TargetParameter>
targets[targetName] input
else
target input
| false, _ ->
printfn $"Could not find build target {targetName}"

[<EntryPoint>]
Expand Down

0 comments on commit f622ea2

Please sign in to comment.