mirror of
https://github.com/IBM/fp-go.git
synced 2025-11-25 22:21:49 +02:00
16 lines
285 B
Go
16 lines
285 B
Go
|
|
package templates
|
||
|
|
|
||
|
|
import (
|
||
|
|
"text/template"
|
||
|
|
|
||
|
|
E "github.com/IBM/fp-go/v2/either"
|
||
|
|
)
|
||
|
|
|
||
|
|
var (
|
||
|
|
templateFunctions = template.FuncMap{}
|
||
|
|
)
|
||
|
|
|
||
|
|
func Parse(name, tmpl string) E.Either[error, *template.Template] {
|
||
|
|
return E.TryCatchError(template.New(name).Funcs(templateFunctions).Parse(tmpl))
|
||
|
|
}
|