lodash: Optimize template. [jddalton]

Former-commit-id: 2cd61549491714e6796308ec437fa8dff8fa9a1b
This commit is contained in:
John-David Dalton
2012-05-03 00:23:57 -04:00
parent a426109c1c
commit 221f70e609
2 changed files with 79 additions and 72 deletions

View File

@@ -84,6 +84,7 @@
'isEqual',
'isFinite',
'setTimeout',
'source',
'templateSettings',
'toArray',
'value',
@@ -112,7 +113,7 @@
// remove whitespace from string literals
source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |use strict|var |'\\n'|\\n|\s+/g, function(match) {
return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |use strict|var |['|]\\n[|']|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match;
});
});