Skip to content

Commit

Permalink
generate regex for m-for
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 3, 2017
1 parent 64a5d53 commit 721f3fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1881,11 +1881,8 @@
var iteratable = compileTemplate(parts[1], false);

var params = aliases.join(",");

code.replace(/instance\.get\("([^"]+)"\)/g, function (match, alias) {
if (aliases.indexOf(alias) !== -1) {
code = code.replace(new RegExp('instance.get\\("' + alias + '"\\)', "g"), alias);
}
code.replace(new RegExp('instance.get("(' + aliases.join("|") + ')")', 'g'), function (match, alias) {
code = code.replace(new RegExp('instance.get\\("' + alias + '"\\)', "g"), alias);
});

return 'instance.renderLoop(' + iteratable + ', function(' + params + ') { return ' + code + '; })';
Expand Down
Loading

0 comments on commit 721f3fe

Please sign in to comment.