Packages

A Gleam library for sending emails using Plunk's API (https://useplunk.com), supports Erlang and JavaScript targets.

Current section

Files

Jump to
plunk src plunk@internal@utils.erl
Raw

src/plunk@internal@utils.erl

-module(plunk@internal@utils).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-define(FILEPATH, "src/plunk/internal/utils.gleam").
-export([omit_if_none/4]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/plunk/internal/utils.gleam", 4).
?DOC(false).
-spec omit_if_none(
list({binary(), gleam@json:json()}),
binary(),
gleam@option:option(HHT),
fun((HHT) -> gleam@json:json())
) -> list({binary(), gleam@json:json()}).
omit_if_none(Fields, Key, Optional_value, Target) ->
case Optional_value of
{some, Value} ->
[{Key, Target(Value)} | Fields];
none ->
Fields
end.