Skip to content

Commit 261d936

Browse files
authored
allow passing AbstractString to Between (#17)
allow passing AbstractString to Between
1 parent ce2fa84 commit 261d936

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DataAPI"
22
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
33
authors = ["quinnj <[email protected]>"]
4-
version = "1.1.0"
4+
version = "1.2.0"
55

66
[compat]
77
julia = "1"

src/DataAPI.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ struct Between{T1 <: Union{Int, Symbol}, T2 <: Union{Int, Symbol}}
103103
last::T2
104104
end
105105

106+
Between(x::AbstractString, y::AbstractString) = Between(Symbol(x), Symbol(y))
107+
Between(x::Union{Int, Symbol}, y::AbstractString) = Between(x, Symbol(y))
108+
Between(x::AbstractString, y::Union{Int, Symbol}) = Between(Symbol(x), y)
109+
106110
"""
107111
All(cols...)
108112

test/runtests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ end
5959

6060
@testset "Between" begin
6161

62-
for x in (1, :a), y in (1, :a)
62+
for x in (1, :a, "a"), y in (1, :a, "a")
6363
b = DataAPI.Between(x, y)
64-
@test b.first == x
65-
@test b.last == y
64+
@test b.first == (x isa Int ? x : Symbol(x))
65+
@test b.last == (y isa Int ? y : Symbol(y))
6666
end
6767

6868
@test_throws MethodError DataAPI.Between(true, 1)

0 commit comments

Comments
 (0)