use binary_part/3 for elixir 1.11 support

This commit is contained in:
sloane 2024-04-22 09:54:12 -04:00
parent 4261b1a00c
commit f686c4650a
No known key found for this signature in database

View file

@ -181,10 +181,10 @@ defmodule TypeID do
prefix =
str
|> binary_slice(0, size - 26)
|> binary_part(0, size - 26)
|> String.replace(~r/_$/, "")
suffix = binary_slice(str, size - 26, 26)
suffix = binary_part(str, size - 26, 26)
if prefix == "" do
raise ArgumentError, "A TypeID without a prefix should not have a leading underscore"