Skip to content

Commit

Permalink
improove perf
Browse files Browse the repository at this point in the history
  • Loading branch information
A committed Apr 19, 2015
1 parent 15b8604 commit ed790d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ module.exports = function textr(defaults) {
*/
function exec(text, options) {
options = clone(defaults, options);
return mws.reduce(function(text, mw) {
return mw.apply(text, [text, options]) || text;
}, text);
var l = mws.length;
for (var i = 0; i < l; i++) {
text = mws[i].apply(text, [text, options]) || text;
}
return text;
}

/**
Expand Down

0 comments on commit ed790d6

Please sign in to comment.