From 7ce5dcdead794704513db663b2088ef953c09b06 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 6 Jul 2013 20:06:14 -0700 Subject: [PATCH] Cleanup `matchProp` and `removeProp` in build.js. Former-commit-id: b30044f7c9ff0d87098d6404341a42d66f51173a --- build.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build.js b/build.js index bc271ed0b..5baed6fea 100755 --- a/build.js +++ b/build.js @@ -1437,7 +1437,7 @@ function matchProp(source, propName) { var result = source.match(RegExp( multilineComment + - 'lodash\\._?' + propName + '\\s*=[\\s\\S]+?' + + '(?: *|.*?=\\s*)lodash\\._?' + propName + '\\s*=[\\s\\S]+?' + '(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);\\n(?=\\n)|' + '[;}]\\n(?=\\n(?!\\s*\\(func)))' )); @@ -1778,13 +1778,13 @@ * @returns {String} Returns the modified source. */ function removeProp(source, propName) { - return source.replace(RegExp( - multilineComment + - '(?: *|(.*?=))lodash\\._?' + propName + '\\s*=[\\s\\S]+?' + - '(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);\\n(?=\\n)|' + - '[;}]\\n(?=\\n(?!\\s*\\(func)))' - ), function(match, prelude) { - return prelude ? 'undefined' : ''; + return source.replace(matchProp(source, propName), function(match) { + var snippet = RegExp( + multilineComment + + '.*?=\\s*(?=lodash\\._?' + propName + '\\s*=)' + ).exec(match); + + return snippet ? snippet[0] + 'undefined;\n' : ''; }); }