Add sourceURL support to _.template.

Former-commit-id: 31d40d57f903098fe1678777aa7921e72d1dca9e
This commit is contained in:
John-David Dalton
2012-06-06 12:01:49 -04:00
parent 5b6ea7afb2
commit 5eabe1a172
4 changed files with 108 additions and 98 deletions

View File

@@ -371,7 +371,7 @@
* @returns {String} Returns the source with whitespace removed.
*/
function removeWhitespace(source) {
return source.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |var |\\\\n|\\n|\s+/g, function(match) {
return source.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |var |@ |\\\\n|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match;
});
}
@@ -461,6 +461,7 @@
if (isMobile) {
// inline functions defined with `createIterator`
lodash.functions(lodash).forEach(function(funcName) {
// match `funcName` with pseudo private `_` prefixes removed to allow matching `shimKeys`
var reFunc = RegExp('(\\bvar ' + funcName.replace(/^_/, '') + ' *= *)createIterator\\(((?:{|[a-zA-Z])[\\s\\S]+?)\\);\\n');
// skip if not defined with `createIterator`