Skip to content

Commit

Permalink
ismissing accepts list of symbols + numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Sep 24, 2024
1 parent 859d540 commit 6a27320
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1110,19 +1110,23 @@ function Base.ismissing(@nospecialize(ids::IDSvector), field::Int)
return length(ids) < field
end

function Base.ismissing(@nospecialize(ids::IDS), path::Vector{<:AbstractString})
function Base.ismissing(@nospecialize(ids::IDS), path::Vector)
if length(path) == 1
return ismissing(ids, Symbol(path[1]))
end
return ismissing(getfield(ids, Symbol(path[1])), path[2:end])
end

function Base.ismissing(@nospecialize(ids::IDSvector), path::Vector{<:AbstractString})
function Base.ismissing(@nospecialize(ids::IDSvector), path::Vector)
if length(path) == 1
return ismissing(ids, path[1])
end
if isdigit(path[1][1]) && parse(Int, path[1]) <= length(ids)
if typeof(path[1]) <: Integer
n = path[1]
else
n = parse(Int, path[1])
end
if n <= length(ids)
return ismissing(ids[n], path[2:end])
else
return true
Expand Down

0 comments on commit 6a27320

Please sign in to comment.