refactor(util) ownRender: for-in -> forEach

This commit is contained in:
coderaiser 2014-10-29 05:12:38 -04:00
parent 37cb01230f
commit 69e5d554db

View file

@ -389,7 +389,7 @@
* @symbols
*/
this.ownRender = function(templ, view, symbols, notEscape) {
var str, param, expr,
var str, expr,
ret = templ,
firstChar,
secondChar;
@ -397,12 +397,14 @@
firstChar = symbols[0];
secondChar = symbols[1] || firstChar;
for (param in view) {
str = view[param];
str = Util.exec(str) || str;
expr = firstChar + param + secondChar;
ret = Util.replaceStr(ret, expr, str, notEscape);
}
Object
.keys(view)
.forEach(function(param) {
str = view[param];
str = Util.exec(str) || str;
expr = firstChar + param + secondChar;
ret = Util.replaceStr(ret, expr, str, notEscape);
});
expr = firstChar + '.*' + secondChar;
ret = Util.replaceStr(ret, expr, '', notEscape);