From a8cdbb65feb4e296051a760043d4a79504f6d60d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 May 2013 23:21:18 -0700 Subject: [PATCH] Move code block to a more related part of build.js. Former-commit-id: c138608bdff2937c51127e129955143ad7a3caec --- build.js | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/build.js b/build.js index 7c0f1c3aa..b4ed5969f 100755 --- a/build.js +++ b/build.js @@ -2909,26 +2909,6 @@ // replace `basicEach` with `_.forEach` in the method assignment snippet source = source.replace(/\bbasicEach(?=\(\[)/g, 'forEach'); } - // modify `_.contains`, `_.every`, `_.find`, `_.some`, and `_.transform` to use the private `indicatorObject` - if (isUnderscore && (/\bbasicEach\(/.test(source) || !useLodashMethod('forOwn'))) { - source = source.replace(matchFunction(source, 'every'), function(match) { - return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); - }); - - source = source.replace(matchFunction(source, 'find'), function(match) { - return match.replace(/return false/, 'return indicatorObject'); - }); - - source = source.replace(matchFunction(source, 'transform'), function(match) { - return match.replace(/return callback[^)]+\)/, '$& && indicatorObject'); - }); - - _.each(['contains', 'some'], function(methodName) { - source = source.replace(matchFunction(source, methodName), function(match) { - return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); - }); - }); - } var context = vm.createContext({ 'clearTimeout': clearTimeout, @@ -2988,6 +2968,27 @@ } }); + // modify `_.contains`, `_.every`, `_.find`, `_.some`, and `_.transform` to use the private `indicatorObject` + if (isUnderscore && (/\bbasicEach\(/.test(source) || !useLodashMethod('forOwn'))) { + source = source.replace(matchFunction(source, 'every'), function(match) { + return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); + }); + + source = source.replace(matchFunction(source, 'find'), function(match) { + return match.replace(/return false/, 'return indicatorObject'); + }); + + source = source.replace(matchFunction(source, 'transform'), function(match) { + return match.replace(/return callback[^)]+\)/, '$& && indicatorObject'); + }); + + _.each(['contains', 'some'], function(methodName) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); + }); + }); + } + // remove `thisArg` from unexposed `forIn` and `forOwn` _.each(['forIn', 'forOwn'], function(methodName) { if (!useLodashMethod(methodName)) {