Skip to content

Commit

Permalink
Extend hascondition method
Browse files Browse the repository at this point in the history
  • Loading branch information
halleysfifthinc committed Jan 29, 2025
1 parent a7d522b commit f058c21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/trial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ true
```
"""
hascondition(trial::Trial, cond::Symbol) = haskey(conditions(trial), cond)
hascondition(trial::Trial, cond::Symbol...) = all(c -> haskey(conditions(trial), c), cond)
hascondition(trial::Trial, cond::Pair{Symbol,T}) where {T} = (get(conditions(trial), cond.first, missing) == cond.second) === true
hascondition(trial::Trial, cond::Pair{Symbol,T}) where {T<:Union{AbstractVector,Tuple}} = (get(conditions(trial), cond.first, missing) cond.second) === true
hascondition(trial::Trial, cond::Pair{Symbol,T}) where {T<:Function} = cond.second(conditions(trial)[cond.first])
Expand Down

0 comments on commit f058c21

Please sign in to comment.