What is the difference between Mustache.render() and Mustache.to_html()?

The documentation makes no mention of Mustache.to_html(), but every tutorial for Mustache.js online uses Mustache.to_html(). Therefore I am surely missing some jewels.

Code examples would be very much appreciated.

Answers:

Answer

Looking at the source, it seems to_html has essentially been deprecated:

// This is here for backwards compatibility with 0.4.x.
exports.to_html = function (template, view, partials, send) {
    var result = render(template, view, partials);

    if (typeof send === "function") {
      send(result);
    } else {
      return result;
    }
};

As you can see it invokes render. The one difference is the extra (optional) send parameter, which is a callback it invokes (sending the result as a parameter).

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.