Simplify createIterator. and remove whitespace between else { in template text.

Former-commit-id: a673f0edbe9b8655cbe1e91d9063e58130172495
This commit is contained in:
John-David Dalton
2012-12-29 16:03:22 -06:00
parent 716a5b9b5a
commit 99e02f30fb
3 changed files with 34 additions and 31 deletions

View File

@@ -35,12 +35,12 @@
/** Used to minify `compileIterator` option properties */
var iteratorOptions = [
'args',
'arrayLoop',
'arrays',
'bottom',
'firstArg',
'hasDontEnumBug',
'isKeysFast',
'objectLoop',
'loop',
'nonEnumArgs',
'noCharByIndex',
'shadowed',
@@ -235,7 +235,7 @@
string = string.slice(captured.length);
}
// avoids removing the '\n' of the `stringEscapes` object
string = string.replace(/\[object |delete |else |function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) {
string = string.replace(/\[object |delete |else (?!{)|function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match;
});
// prepend object literal property name
@@ -256,7 +256,7 @@
.replace('"\';\n"', '"\';"')
// remove `useSourceURL` variable
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *\{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');
// remove debug sourceURL use in `_.template`
source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');