From 5f2f15b9765d5f7eeff6a984955eb45bc8936e40 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 7 Jun 2012 03:27:01 -0400 Subject: [PATCH] Remove `_.isArguments` fallback from mobile build. Former-commit-id: d98ac9953e9b403e17bdcef099caafe09873980f --- build.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/build.js b/build.js index c52cd0eda..1a7773c3e 100755 --- a/build.js +++ b/build.js @@ -242,7 +242,7 @@ } /** - * Determines if all functions of the given names have been removed from the `source`. + * Determines if all functions of the given names have been removed from `source`. * * @private * @param {String} source The source to inspect. @@ -256,7 +256,7 @@ } /** - * Searches the `source` for a `funcName` function declaration, expression, or + * Searches `source` for a `funcName` function declaration, expression, or * assignment and returns the matched snippet. * * @private @@ -300,7 +300,7 @@ /** * Removes the `funcName` function declaration, expression, or assignment and - * associated code from the `source`. + * associated code from `source`. * * @private * @param {String} source The source to process. @@ -333,7 +333,18 @@ } /** - * Removes a given variable from the `source`. + * Removes the `_.isArguments` fallback from `source`. + * + * @private + * @param {String} source The source to process. + * @returns {String} Returns the source with the `isArguments` fallback removed. + */ + function removeIsArgumentsFallback(source) { + return source.replace(/(?: *\/\/.*)*\s*if *\(!isArguments[^)]+\)[\s\S]+?};?\s*}\n/, ''); + } + + /** + * Removes a given variable from `source`. * * @private * @param {String} source The source to process. @@ -409,8 +420,7 @@ // remove associated functions, variables and code snippets if (isRemoved(source, 'isArguments')) { - // remove `isArguments` if-statement - source = source.replace(/(?:\s*\/\/.*)*\s*if *\(!isArguments[^)]+\)[\s\S]+?};?\s*}\n/, ''); + source = removeIsArgumentsFallback(source); } if (isRemoved(source, 'mixin')) { // remove `LoDash` constructor @@ -477,7 +487,8 @@ source = source.replace(reFunc, '$1' + code + ';\n'); }); - // remove `iteratorTemplate` + source = removeIsArgumentsFallback(source); + source = removeVar(source, 'iteratorTemplate'); // remove JScript [[DontEnum]] fix from `isEqual`