mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactor(util) ownRender: for-in -> forEach
This commit is contained in:
parent
37cb01230f
commit
69e5d554db
1 changed files with 9 additions and 7 deletions
16
lib/util.js
16
lib/util.js
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue