mustacheCore.makeEvaluator
Given a scope and expression, returns a function that evaluates that expression in the scope.
This function first reads lookup values in the args and hash. Then it tries to figure out
if a helper is being called or a value is being read. Finally, depending on
if it’s a helper, or not, and which mode the expression is in, it returns
a function that can quickly evaluate the expression.
makeEvaluator: function (scope, helperOptions, nodeList, mode, exprData, truthyRenderer, falseyRenderer, stringOnly) {
if(mode === "^") {
var temp = truthyRenderer;
truthyRenderer = falseyRenderer;
falseyRenderer = temp;
}
var value,
helperOptionArg;
if(exprData instanceof expression.Call) {
helperOptionArg = {
fn: function () {},
inverse: function () {},
context: scope.attr("."),
scope: scope,
nodeList: nodeList,
exprData: exprData,
helpersScope: helperOptions
};
utils.convertToScopes(helperOptionArg, scope,helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
value = exprData.value(scope, helperOptions, helperOptionArg);
if(exprData.isHelper) {
return value;
}
} else {
var readOptions = {