mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Move _.isArguments fallback noArgsClass work into removeNoArgsClass in build.js.
Former-commit-id: 3627e59c65b67a61fc5ee04166004e400d816d13
This commit is contained in:
12
build.js
12
build.js
@@ -716,7 +716,7 @@
|
||||
* @returns {String} Returns the `isArguments` fallback.
|
||||
*/
|
||||
function getIsArgumentsFallback(source) {
|
||||
return (source.match(/(?:\s*\/\/.*)*\n( *)if *\(noArgsClass\)[\s\S]+?};\n\1}/) || [''])[0];
|
||||
return (source.match(/(?:\s*\/\/.*)*\n( *)if *\((?:noArgsClass|!isArguments)[\s\S]+?};\n\1}/) || [''])[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1064,6 +1064,11 @@
|
||||
function removeNoArgsClass(source) {
|
||||
source = removeVar(source, 'noArgsClass');
|
||||
|
||||
// replace `noArgsClass` in the `_.isArguments` fallback
|
||||
source = source.replace(getIsArgumentsFallback(source), function(match) {
|
||||
return match.replace(/noArgsClass/g, '!isArguments(arguments)');
|
||||
});
|
||||
|
||||
// remove `noArgsClass` from `_.isEmpty`
|
||||
source = source.replace(matchFunction(source, 'isEmpty'), function(match) {
|
||||
return match.replace(/ *\|\| *\(noArgsClass *&&[^)]+?\)\)/g, '');
|
||||
@@ -2185,11 +2190,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// replace `noArgsClass` in the `_.isArguments` fallback
|
||||
source = source.replace(getIsArgumentsFallback(source), function(match) {
|
||||
return match.replace(/noArgsClass/g, '!isArguments(arguments)');
|
||||
});
|
||||
|
||||
// remove chainability from `each` and `_.forEach`
|
||||
_.each(['each', 'forEach'], function(methodName) {
|
||||
source = source.replace(matchFunction(source, methodName), function(match) {
|
||||
|
||||
Reference in New Issue
Block a user