-
-
Save aanoaa/4343136 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mustache = require('mustache'); | |
var view = { | |
title: "Joe", | |
calc: function () { | |
return 2 + 4; | |
} | |
}; | |
var view2 = { | |
results: [ | |
{status:1}, | |
{status:2}, | |
] | |
}; | |
var output = Mustache.render("{{title}} spends {{calc}}", view); | |
console.log(output); | |
output = Mustache.render("{{#results}}{{status}}{{/results}}", view2); | |
console.log(output); | |
var json = JSON.stringify(view2); | |
console.log(json); | |
var view3 = JSON.parse(json) | |
output = Mustache.render("{{#results}}{{status}}{{/results}}", view3); | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment