diff --git a/Project.toml b/Project.toml index be43218c..c672e08d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "StructArrays" uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" -version = "0.6.14" +version = "0.6.15" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/utils.jl b/src/utils.jl index f1ade86a..c4874d72 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -203,8 +203,8 @@ maybe_convert_elt(::Type{T}, vals::NamedTuple) where T = T<:NamedTuple ? convert Compute the unique value that `f` takes on each `component ∈ componenents`. If not all values are equal, return `nothing`. Otherwise, return the unique value. """ -function findconsistentvalue(f::F, (col, cols...)::Tup) where F - val = f(col) - isconsistent = mapfoldl(isequal(val)∘f, &, cols; init=true) +function findconsistentvalue(f::F, cols::Tup) where F + val = f(first(cols)) + isconsistent = all(map(isequal(val) ∘ f, values(cols))) return ifelse(isconsistent, val, nothing) end