mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Cleanup matchProp and removeProp in build.js.
Former-commit-id: b30044f7c9ff0d87098d6404341a42d66f51173a
This commit is contained in:
16
build.js
16
build.js
@@ -1437,7 +1437,7 @@
|
|||||||
function matchProp(source, propName) {
|
function matchProp(source, propName) {
|
||||||
var result = source.match(RegExp(
|
var result = source.match(RegExp(
|
||||||
multilineComment +
|
multilineComment +
|
||||||
'lodash\\._?' + propName + '\\s*=[\\s\\S]+?' +
|
'(?: *|.*?=\\s*)lodash\\._?' + propName + '\\s*=[\\s\\S]+?' +
|
||||||
'(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);\\n(?=\\n)|' +
|
'(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);\\n(?=\\n)|' +
|
||||||
'[;}]\\n(?=\\n(?!\\s*\\(func)))'
|
'[;}]\\n(?=\\n(?!\\s*\\(func)))'
|
||||||
));
|
));
|
||||||
@@ -1778,13 +1778,13 @@
|
|||||||
* @returns {String} Returns the modified source.
|
* @returns {String} Returns the modified source.
|
||||||
*/
|
*/
|
||||||
function removeProp(source, propName) {
|
function removeProp(source, propName) {
|
||||||
return source.replace(RegExp(
|
return source.replace(matchProp(source, propName), function(match) {
|
||||||
multilineComment +
|
var snippet = RegExp(
|
||||||
'(?: *|(.*?=))lodash\\._?' + propName + '\\s*=[\\s\\S]+?' +
|
multilineComment +
|
||||||
'(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);\\n(?=\\n)|' +
|
'.*?=\\s*(?=lodash\\._?' + propName + '\\s*=)'
|
||||||
'[;}]\\n(?=\\n(?!\\s*\\(func)))'
|
).exec(match);
|
||||||
), function(match, prelude) {
|
|
||||||
return prelude ? 'undefined' : '';
|
return snippet ? snippet[0] + 'undefined;\n' : '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user