Skip to content

Commit

Permalink
Add method value(::Nothing)
Browse files Browse the repository at this point in the history
  • Loading branch information
simsurace committed Feb 6, 2024
1 parent 567b070 commit d65911b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/parameters_base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ value(x::AbstractArray) = map(value, x)
value(x::Tuple) = map(value, x)
value(x::NamedTuple) = map(value, x)
value(x::Dict) = Dict(k => value(v) for (k, v) in x)
value(::Nothing) = nothing
2 changes: 1 addition & 1 deletion test/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
end

@testset "value_flatten" begin
x = (ones(3), fixed(5.0), (a=fixed(5.0), b=[6.0, 2.1]))
x = (ones(3), fixed(5.0), (a=fixed(5.0), b=[6.0, 2.1]), nothing)
v, unflatten = value_flatten(x)

@test length(v) == 5
Expand Down

0 comments on commit d65911b

Please sign in to comment.