mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Use invert to assign htmlUnescapes.
Former-commit-id: 20f9f29d622643e2f59bbc4a57fd2456c09ef49e
This commit is contained in:
21
build.js
21
build.js
@@ -768,18 +768,20 @@
|
||||
*/
|
||||
function replaceVar(source, varName, varValue) {
|
||||
// replace a variable that's not part of a declaration list
|
||||
source = source.replace(RegExp(
|
||||
var result = source.replace(RegExp(
|
||||
'(( +)var ' + varName + ' *= *)' +
|
||||
'(?:.+?;|(?:Function\\(.+?|.*?[^,])\\n[\\s\\S]+?\\n\\2.+?;)\\n'
|
||||
), '$1' + varValue + ';\n');
|
||||
|
||||
// replace a varaible at the start or middle of a declaration list
|
||||
source = source.replace(RegExp('((?:var|\\n) +' + varName + ' *=).+?,'), '$1 ' + varValue + ',');
|
||||
|
||||
// replace a variable at the end of a variable declaration list
|
||||
source = source.replace(RegExp('(,\\s*' + varName + ' *=).+?;'), '$1 ' + varValue + ';');
|
||||
|
||||
return source;
|
||||
if (source == result) {
|
||||
// replace a varaible at the start or middle of a declaration list
|
||||
result = source.replace(RegExp('((?:var|\\n) +' + varName + ' *=).+?,'), '$1 ' + varValue + ',');
|
||||
}
|
||||
if (source == result) {
|
||||
// replace a variable at the end of a variable declaration list
|
||||
result = source.replace(RegExp('(,\\s*' + varName + ' *=).+?;'), '$1 ' + varValue + ';');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1321,6 +1323,9 @@
|
||||
}
|
||||
else {
|
||||
// modify/remove references to removed methods/variables
|
||||
if (isRemoved(source, 'invert')) {
|
||||
source = replaceVar(source, 'htmlUnescapes', "{'&':'&','<':'<','>':'>','"':'\"',''':\"'\"}");
|
||||
}
|
||||
if (isRemoved(source, 'isArguments')) {
|
||||
source = replaceVar(source, 'noArgsClass', 'false');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user