Packages

A hardcore language for buildling extreme systems

Current section

Files

Jump to
gloom src template.erl
Raw

src/template.erl

-module(template).
-compile([no_auto_import, nowarn_unused_vars]).
-export([template_replace_all/2]).
-spec template_replace(binary(), binary(), binary()) -> binary().
template_replace(Template, Parameter, Value) ->
gleam@string:replace(
Template,
<<<<"{"/utf8, Parameter/binary>>/binary, "}"/utf8>>,
Value
).
-spec template_replace_all(binary(), gleam@map:map_(binary(), binary())) -> binary().
template_replace_all(Template, Parameter_mappings) ->
gleam@map:fold(Parameter_mappings, Template, fun template_replace/3).