< Summary

Information
Class: src/postprocess.jl
Assembly: Default
File(s): src/postprocess.jl
Tag: 61_25545638018
Line coverage
100%
Covered lines: 31
Uncovered lines: 0
Coverable lines: 31
Total lines: 45
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

src/postprocess.jl

#LineLine coverage
 291_isnullish(v) = v === missing || v === nothing
 2
 143function _all_null(d::AbstractDict)
 284    for v in values(d)
 295        _isnullish(v) || return false
 116    end
 37    return true
 8end
 9
 6310function _prune_null_objects!(v)
 6311    if isa(v, AbstractDict)
 1212        for (k, child) in v
 2313            v[k] = _prune_null_objects!(child)
 2314        end
 1215        return v
 7116    elseif isa(v, AbstractVector) && !isempty(v) && all(x -> isa(x, AbstractDict), v)
 2217        filter!(d -> !_all_null(d), v)
 818        for d in v
 1119            _prune_null_objects!(d)
 1120        end
 821        return v
 4322    elseif isa(v, AbstractVector)
 523        for i in eachindex(v)
 624            v[i] = _prune_null_objects!(v[i])
 925        end
 526        return v
 27    end
 3828    return v
 29end
 30
 31"""
 32    omit_null_objects!(jws::JSONWorksheet)
 33
 34Walk every row and drop elements of object arrays whose every field is `missing`
 35or `nothing`. Recurses into nested dicts and arrays. Mixed arrays (some elements
 36dicts, some not) are left untouched. Returns `jws`.
 37"""
 538function omit_null_objects!(jws::JSONWorksheet)
 539    for row in jws.data
 1140        for p in keys(row)
 2341            row[p] = _prune_null_objects!(row[p])
 2342        end
 1143    end
 544    return jws
 45end

Methods/Properties