diff --git a/src/VersionParsing.jl b/src/VersionParsing.jl index b3de9a5..9e42fab 100644 --- a/src/VersionParsing.jl +++ b/src/VersionParsing.jl @@ -34,7 +34,7 @@ For example, vparse(s::AbstractString) = vparse(String(s)) digits2num(s::AbstractString) = all(isdigit, s) ? parse(Int, s) : s -splitparts(s::AbstractString) = map(digits2num, filter!(!isempty, split(s, '.'))) +splitparts(s::T) where {T <: AbstractString} = Union{Int, T}[digits2num(x) for x in filter!(!isempty, split(s, '.'))] function vparse(s_::String) s = replace(s_, r"^[^\d]*[^.\d](\.?\d)"=>s"\1") # strip non-numeric prefix @@ -76,4 +76,6 @@ function vparse(s_::String) end end +precompile(Tuple{typeof(vparse), String}) + end # module