Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "minstache", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Mini mustache template engine", | ||
@@ -5,0 +5,0 @@ "keywords": ["mustache", "template", "engine"], |
1.1.0 / 2013-07-04 | ||
1.2.0 / 2014-06-17 | ||
================== | ||
* add iteration support. Closes #10 | ||
1.1.0 / 2013-07-04 | ||
================== | ||
* add unescaped property support | ||
@@ -6,0 +11,0 @@ * remove support for single braces |
15
index.js
@@ -50,3 +50,3 @@ | ||
tok = tok.slice(1); | ||
js.push(') + '); | ||
js.push(' }) + '); | ||
break; | ||
@@ -56,3 +56,3 @@ case '^': | ||
assertProperty(tok); | ||
js.push(' + section(obj, "' + tok + '", true, '); | ||
js.push(' + section(obj, "' + tok + '", true, function(obj){ return '); | ||
break; | ||
@@ -62,3 +62,3 @@ case '#': | ||
assertProperty(tok); | ||
js.push(' + section(obj, "' + tok + '", false, '); | ||
js.push(' + section(obj, "' + tok + '", false, function(obj){ return '); | ||
break; | ||
@@ -125,3 +125,3 @@ case '!': | ||
* @param {String} prop | ||
* @param {String} str | ||
* @param {Function} thunk | ||
* @param {Boolean} negate | ||
@@ -131,7 +131,8 @@ * @api private | ||
function section(obj, prop, negate, str) { | ||
function section(obj, prop, negate, thunk) { | ||
var val = obj[prop]; | ||
if ('function' == typeof val) return val.call(obj, str); | ||
if (Array.isArray(val)) return val.map(thunk).join(''); | ||
if ('function' == typeof val) return val.call(obj, thunk(obj)); | ||
if (negate) val = !val; | ||
if (val) return str; | ||
if (val) return thunk(obj); | ||
return ''; | ||
@@ -138,0 +139,0 @@ } |
{ | ||
"name": "minstache", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Mini mustache template engine", | ||
@@ -5,0 +5,0 @@ "keywords": ["mustache", "template", "engine"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5935
37935
136