Skip to content

Commit

Permalink
Support flattening vectors of prov.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHatherly committed Dec 8, 2020
1 parent 94c7331 commit b66ffda
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ProvenanceBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ function flat!(out, nt::NamedTuple, root = ())
return out
end
flat!(out, ::Nothing, root = ()) = out
function flat!(out, v::AbstractVector, root)
for (nth, each) in enumerate(v)
flat!(out, each, (root..., nth))
end
return out
end
flat!(out, value, root) = (out[root] = value; out)
flat!(out, p::Provenance, root) = flat!(out, p.data, root)

Expand Down

0 comments on commit b66ffda

Please sign in to comment.