< Summary

Class:src/jsonpointer.jl
Assembly:Default
File(s):src/jsonpointer.jl
Covered lines:14
Uncovered lines:9
Coverable lines:23
Total lines:46
Line coverage:60.8% (14 of 23)
Covered branches:0
Total branches:0
Tag:43_456648716

File(s)

src/jsonpointer.jl

#LineLine coverage
 1
 2"""
 3_column_to_pointer{T}(p::Pointer)
 4
 5construct JSONPointer.Pointer with specified type
 6"""
 7function _column_to_pointer(token_string::AbstractString)::Pointer
 4608    if !startswith(token_string, JSONPointer.TOKEN_PREFIX)
 159        token_string = "/" * token_string
 10    end
 23011    if endswith(token_string, "}")
 1812        x = split(token_string, "{")
 1813        p = Pointer(x[1])
 1814        T = jsontype_to_juliatype(x[2][1:end-1])
 15
 1816        return Pointer{Array{T, 1}}(p.tokens)
 17    else
 21218        return Pointer(token_string)
 19    end
 20end
 21
 22function jsontype_to_juliatype(t)
 1823    if t == "string"
 324        return String
 1525    elseif t == "number"
 726        return Float64
 27    # JSON does not have distinct types for integers and floating-point values
 28    # but Excel does, and distinguishing integer is useful for many things.
 829    elseif t == "integer"
 830        return Int
 031    elseif t == "object"
 032        return OrderedCollections.OrderedDict{String,Any}
 033    elseif t == "array"
 034        return Vector{Any}
 035    elseif t == "boolean"
 036        return Bool
 037    elseif t == "null"
 038        return Missing
 39    else
 040        error(
 41            "You specified a type that JSON doesn't recognize! Instead of " *
 42            "`::$t`, you must use one of `::string`, `::number`, " *
 43            "`::object`, `::array`, `::boolean`, or `::null`."
 44        )
 45    end
 46end

Methods/Properties