Skip to content

Commit b3e4355

Browse files
committed
Fix bad syntax on Elixir 1.11 and older
1 parent 6818ef2 commit b3e4355

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/sqids/alphabet.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ defmodule Sqids.Alphabet do
5656
def char_at!(alphabet, index), do: Map.fetch!(alphabet, index)
5757

5858
@spec split_and_exchange!(t(), index) :: t()
59-
def split_and_exchange!(alphabet, split_index) when split_index in 0..(map_size(alphabet) - 1)//1 do
59+
def split_and_exchange!(alphabet, split_index) when split_index >= 0 and split_index <= map_size(alphabet) - 1 do
6060
alphabet_size = map_size(alphabet)
6161

6262
map(alphabet, fn {index, char} ->
@@ -82,7 +82,7 @@ defmodule Sqids.Alphabet do
8282
end
8383

8484
@spec get_slice_chars!(t(), pos_integer) :: [byte, ...]
85-
def get_slice_chars!(alphabet, size) when size in 1..map_size(alphabet)//1 do
85+
def get_slice_chars!(alphabet, size) when size >= 1 and size <= map_size(alphabet) do
8686
Enum.reduce((size - 1)..0, _acc = [], fn index, acc -> [char_at!(alphabet, index) | acc] end)
8787
end
8888

0 commit comments

Comments
 (0)