mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Add isShallow to getVars in build.js.
Former-commit-id: c863a26a1e43e4ab8b0d4d84ecea78653663660e
This commit is contained in:
16
build.js
16
build.js
@@ -1061,11 +1061,15 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {String} source The source to process.
|
* @param {String} source The source to process.
|
||||||
|
* @param {Boolean} [isShallow=false] A flag to indicate looking for varaibles one closure deep.
|
||||||
* @returns {Array} Returns a new array of variable names.
|
* @returns {Array} Returns a new array of variable names.
|
||||||
*/
|
*/
|
||||||
function getVars(source) {
|
function getVars(source, isShallow) {
|
||||||
var indentA = isRemoved(source, 'runInContext') ? ' {2}' : ' {2,4}',
|
if (isShallow == null) {
|
||||||
indentB = isRemoved(source, 'runInContext') ? ' {6}' : ' {6,8}',
|
isShallow = isRemoved(source, 'runInContext');
|
||||||
|
}
|
||||||
|
var indentA = isShallow ? ' {2}' : ' {2,4}',
|
||||||
|
indentB = isShallow ? ' {6}' : ' {6,8}',
|
||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
var snippet = removeComments(source);
|
var snippet = removeComments(source);
|
||||||
@@ -3615,9 +3619,9 @@
|
|||||||
|
|
||||||
// remove unused variables
|
// remove unused variables
|
||||||
(function() {
|
(function() {
|
||||||
var useMap = {},
|
var isShallow = isRemoved(source, 'runInContext'),
|
||||||
varNames = getVars(source),
|
useMap = {},
|
||||||
isShallow = isRemoved(source, 'runInContext');
|
varNames = getVars(source, isShallow);
|
||||||
|
|
||||||
while (varNames.length) {
|
while (varNames.length) {
|
||||||
varNames = _.sortBy(varNames, function(varName) {
|
varNames = _.sortBy(varNames, function(varName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user