cap integer range

This commit is contained in:
byte[] 2021-03-17 18:06:04 -04:00
parent b7ac164afd
commit b44e1c7765

View file

@ -17,7 +17,10 @@ defmodule Philomena.Search.Helpers do
def to_int(term) do
{int, _} = :string.to_integer(term)
int
case int in -2_147_483_648..2_147_483_647 do
true -> int
_false -> 0
end
end
def range([center, deviation]) do