@@ -79,7 +79,8 @@ defmodule JsonRemedy.Utils.CharUtils do
7979 nil
8080 """
8181 @ spec get_char_at ( String . t ( ) | nil , position ( ) , any ( ) ) :: any ( )
82- def get_char_at ( input , position , default ) when is_binary ( input ) and is_integer ( position ) and position >= 0 do
82+ def get_char_at ( input , position , default )
83+ when is_binary ( input ) and is_integer ( position ) and position >= 0 do
8384 case String . at ( input , position ) do
8485 nil -> default
8586 char -> char
@@ -125,7 +126,8 @@ defmodule JsonRemedy.Utils.CharUtils do
125126 """
126127 @ spec skip_to_character ( String . t ( ) | nil , String . t ( ) | nil , position ( ) ) :: search_result ( )
127128 def skip_to_character ( input , target_char , start_pos )
128- when is_binary ( input ) and is_binary ( target_char ) and is_integer ( start_pos ) and start_pos >= 0 do
129+ when is_binary ( input ) and is_binary ( target_char ) and is_integer ( start_pos ) and
130+ start_pos >= 0 do
129131 input_length = String . length ( input )
130132
131133 if start_pos >= input_length do
@@ -174,15 +176,18 @@ defmodule JsonRemedy.Utils.CharUtils do
174176 """
175177 @ spec skip_whitespaces_at ( String . t ( ) | nil , position ( ) , position ( ) ) :: position ( )
176178 def skip_whitespaces_at ( input , start_pos , end_pos )
177- when is_binary ( input ) and is_integer ( start_pos ) and is_integer ( end_pos )
178- and start_pos >= 0 and end_pos >= 0 do
179+ when is_binary ( input ) and is_integer ( start_pos ) and is_integer ( end_pos ) and
180+ start_pos >= 0 and end_pos >= 0 do
179181 input_length = String . length ( input )
180182 actual_end = min ( end_pos , input_length )
181183
182184 skip_whitespace_loop ( input , start_pos , actual_end )
183185 end
184186
185- def skip_whitespaces_at ( _input , start_pos , _end_pos ) when is_integer ( start_pos ) and start_pos >= 0 , do: start_pos
187+ def skip_whitespaces_at ( _input , start_pos , _end_pos )
188+ when is_integer ( start_pos ) and start_pos >= 0 ,
189+ do: start_pos
190+
186191 def skip_whitespaces_at ( _input , _start_pos , _end_pos ) , do: 0
187192
188193 @ doc """
@@ -265,16 +270,19 @@ defmodule JsonRemedy.Utils.CharUtils do
265270 nil
266271 """
267272 @ spec char_at_position_safe ( String . t ( ) | nil , position ( ) ) :: char_result ( )
268- def char_at_position_safe ( input , position ) when is_binary ( input ) and is_integer ( position ) and position >= 0 do
273+ def char_at_position_safe ( input , position )
274+ when is_binary ( input ) and is_integer ( position ) and position >= 0 do
269275 String . at ( input , position )
270276 end
271277
272278 def char_at_position_safe ( _input , _position ) , do: nil
273279
274280 # Private helper functions
275281
276- @ spec find_character_from_position ( String . t ( ) , String . t ( ) , position ( ) , position ( ) ) :: search_result ( )
277- defp find_character_from_position ( input , target_char , pos , input_length ) when pos < input_length do
282+ @ spec find_character_from_position ( String . t ( ) , String . t ( ) , position ( ) , position ( ) ) ::
283+ search_result ( )
284+ defp find_character_from_position ( input , target_char , pos , input_length )
285+ when pos < input_length do
278286 case String . at ( input , pos ) do
279287 ^ target_char -> pos
280288 _ -> find_character_from_position ( input , target_char , pos + 1 , input_length )
@@ -288,6 +296,7 @@ defmodule JsonRemedy.Utils.CharUtils do
288296 case String . at ( input , pos ) do
289297 char when char in [ " " , "\t " , "\n " , "\r " , "\f " , "\v " ] ->
290298 skip_whitespace_loop ( input , pos + 1 , end_pos )
299+
291300 _ ->
292301 pos
293302 end
0 commit comments