Module
Data.TemplateLiteral
- Package
- purescript-template-literals
- Repository
- nonbili/purescript-template-literals
#template Source
template :: forall a. EncodeJson (Record a) => String -> Record a -> Effect String
The first argument is treated as template literals, and interpolated by the
second argument. The second argument will be encoded to Json
before
passed through FFI.
Example:
> template "Hello, ${t}!" { t: Just "world" }
"Hello, world!"
#template' Source
template' :: forall a. String -> Record a -> Effect String
The first argument is treated as template literals. The second argument
will be coerced to Foreign
.
Example:
> template' "Hello, ${t}!" { t: Just "world" }
"Hello, [ojbect Object]"
> template' "${text} - ${tr(text)}!" { text: "hello", tr: String.toUpper }
"hello - HELLO"