Plato on Github
Report Home
template/engine.js
Maintainability
129.60
Lines of code
41
Difficulty
22.50
Estimated Errors
0.22
Function weight
By Complexity
By SLOC
/** * @module Lyria * @submodule Template */ define('lyria/template/engine', ['root', 'lyria/template/connector', 'lyria/template/methods'], function(root, TemplateConnector, templateMethods) { var noop = function() { }; /** * @class Engine * @constructor * * @param {Object} templateConnector */ var TemplateEngine = function(templateConnector) { if ( templateConnector instanceof TemplateConnector) { for (var i = 0, j = templateMethods.length; i < j; i++) { (function(iterator) { if ((templateConnector[iterator] != null) && ( typeof templateConnector[iterator] === 'function')) { TemplateEngine[iterator] = templateConnector[iterator]; } else { TemplateEngine[iterator] = noop; } })(templateMethods[i]); } } }; if (root.Handlebars) { var handlebarsConnector = new TemplateConnector({ compile: function() { return root.Handlebars.template.apply(this, arguments); }, globalHelpers: function() { return root.Handlebars.helpers; } }); TemplateEngine(handlebarsConnector); } return TemplateEngine; });