diff --git a/build.js b/build.js index ee2f95329..3506c072d 100755 --- a/build.js +++ b/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) {