src/plugins/mustache.js
Function mustacheFactory
has a Cognitive Complexity of 170 (exceeds 5 allowed). Consider refactoring. Open
Open
}(this, function mustacheFactory (mustache) {
var objectToString = Object.prototype.toString;
var isArray = Array.isArray || function isArrayPolyfill (object) {
return objectToString.call(object) === '[object Array]';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function mustacheFactory
has 349 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}(this, function mustacheFactory (mustache) {
var objectToString = Object.prototype.toString;
var isArray = Array.isArray || function isArrayPolyfill (object) {
return objectToString.call(object) === '[object Array]';
File mustache.js
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
Function parseTemplate
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseTemplate (template, tags) {
if (!template)
return [];
var sections = []; // Stack to hold section tokens
Function lookup
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Context.prototype.lookup = function lookup (name) {
var cache = this.cache;
var value;
if (name in cache) {
Avoid deeply nested control flow statements. Open
Open
if (index === names.length - 1 && value != null)
lookupHit = (typeof value === 'object') &&
value.hasOwnProperty(names[index]);