From b3e4355b774ee608e783cfc2d42888c1624f9c2b Mon Sep 17 00:00:00 2001 From: Guilherme Date: Fri, 14 Jun 2024 10:12:42 +0100 Subject: [PATCH] Fix bad syntax on Elixir 1.11 and older --- lib/sqids/alphabet.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqids/alphabet.ex b/lib/sqids/alphabet.ex index 6f59aae..3203b23 100644 --- a/lib/sqids/alphabet.ex +++ b/lib/sqids/alphabet.ex @@ -56,7 +56,7 @@ defmodule Sqids.Alphabet do def char_at!(alphabet, index), do: Map.fetch!(alphabet, index) @spec split_and_exchange!(t(), index) :: t() - def split_and_exchange!(alphabet, split_index) when split_index in 0..(map_size(alphabet) - 1)//1 do + def split_and_exchange!(alphabet, split_index) when split_index >= 0 and split_index <= map_size(alphabet) - 1 do alphabet_size = map_size(alphabet) map(alphabet, fn {index, char} -> @@ -82,7 +82,7 @@ defmodule Sqids.Alphabet do end @spec get_slice_chars!(t(), pos_integer) :: [byte, ...] - def get_slice_chars!(alphabet, size) when size in 1..map_size(alphabet)//1 do + def get_slice_chars!(alphabet, size) when size >= 1 and size <= map_size(alphabet) do Enum.reduce((size - 1)..0, _acc = [], fn index, acc -> [char_at!(alphabet, index) | acc] end) end