defmodule Fast.Guards do defguard is_uuid4(s) # hyphens at 8, 13, 18, 23 # version nibble '4' at pos 14 # variant nibble 8|9|a|b (case-insensitive) at pos 19 when is_binary(s) and byte_size(s) == 36 and binary_part(s, 8, 1) == "-" and binary_part(s, 13, 1) == "-" and binary_part(s, 18, 1) == "-" and binary_part(s, 23, 1) == "-" and binary_part(s, 14, 1) == "4" and (binary_part(s, 19, 1) == "8" or binary_part(s, 19, 1) == "9" or binary_part(s, 19, 1) == "a" or binary_part(s, 19, 1) == "A" or binary_part(s, 19, 1) == "b" or binary_part(s, 19, 1) == "B") end