defmodule Paraxial do @moduledoc """ Paraxial.io functions for use by users. """ alias Paraxial.Helpers def bulk_allowed?(email, bulk_action, count) do # bulk map: bulk: %{emails: %{trusted: 100, untrusted: 5}} # trusted domains: trusted_domains: ["blackcatprojects.xyz", "paraxial.io"] bulk_map = Helpers.get_bulk_map() trusted_domains = Helpers.get_trusted_domains() limits = bulk_map[bulk_action] if email_trusted?(email, trusted_domains) do count <= limits[:trusted] else count <= limits[:untrusted] end end def email_trusted?(email, trusted_domains) do [_h, domain] = String.split(email, "@") domain in trusted_domains end end