Creates a reusable template function from a mustache template string.
The template string to compile
A function that accepts a context object and returns the rendered string
const greet = template("Hello, {{ name }}!");const result1 = greet({ name: "Alice" }); // "Hello, Alice!"const result2 = greet({ name: "Bob" }); // "Hello, Bob!" Copy
const greet = template("Hello, {{ name }}!");const result1 = greet({ name: "Alice" }); // "Hello, Alice!"const result2 = greet({ name: "Bob" }); // "Hello, Bob!"
Creates a reusable template function from a mustache template string.