mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Correct use of function and method terms in build/tests.
Former-commit-id: be0ff50ce30925313716acf15470bd0fa480f6a4
This commit is contained in:
@@ -89,158 +89,127 @@
|
|||||||
'zipObject': ['object']
|
'zipObject': ['object']
|
||||||
};
|
};
|
||||||
|
|
||||||
/** List of all methods */
|
/** Used to track the category of functions */
|
||||||
var allMethods = _.functions(_).filter(function(methodName) {
|
var categoryMap = {
|
||||||
return !/^_/.test(methodName);
|
'Arrays': [
|
||||||
});
|
'compact',
|
||||||
|
'difference',
|
||||||
/** List of "Arrays" category methods */
|
'findIndex',
|
||||||
var arraysMethods = [
|
'first',
|
||||||
'compact',
|
'flatten',
|
||||||
'difference',
|
'indexOf',
|
||||||
'drop',
|
'initial',
|
||||||
'findIndex',
|
'intersection',
|
||||||
'first',
|
'last',
|
||||||
'flatten',
|
'lastIndexOf',
|
||||||
'head',
|
'range',
|
||||||
'indexOf',
|
'rest',
|
||||||
'initial',
|
'sortedIndex',
|
||||||
'intersection',
|
'union',
|
||||||
'last',
|
'uniq',
|
||||||
'lastIndexOf',
|
'unzip',
|
||||||
'object',
|
'without',
|
||||||
'range',
|
'zip',
|
||||||
'rest',
|
'zipObject'
|
||||||
'sortedIndex',
|
],
|
||||||
'tail',
|
'Chaining': [
|
||||||
'take',
|
'chain',
|
||||||
'union',
|
'tap',
|
||||||
'uniq',
|
'value'
|
||||||
'unique',
|
],
|
||||||
'unzip',
|
'Collections': [
|
||||||
'without',
|
'at',
|
||||||
'zip',
|
'contains',
|
||||||
'zipObject'
|
'countBy',
|
||||||
];
|
'every',
|
||||||
|
'filter',
|
||||||
/** List of "Chaining" category methods */
|
'find',
|
||||||
var chainingMethods = [
|
'findWhere',
|
||||||
'chain',
|
'forEach',
|
||||||
'tap',
|
'groupBy',
|
||||||
'value'
|
'invoke',
|
||||||
];
|
'map',
|
||||||
|
'max',
|
||||||
/** List of "Collections" category methods */
|
'min',
|
||||||
var collectionsMethods = [
|
'pluck',
|
||||||
'all',
|
'reduce',
|
||||||
'any',
|
'reduceRight',
|
||||||
'at',
|
'reject',
|
||||||
'collect',
|
'shuffle',
|
||||||
'contains',
|
'size',
|
||||||
'countBy',
|
'some',
|
||||||
'detect',
|
'sortBy',
|
||||||
'each',
|
'toArray',
|
||||||
'every',
|
'where'
|
||||||
'filter',
|
],
|
||||||
'find',
|
'Functions': [
|
||||||
'findWhere',
|
'after',
|
||||||
'foldl',
|
'bind',
|
||||||
'foldr',
|
'bindAll',
|
||||||
'forEach',
|
'bindKey',
|
||||||
'groupBy',
|
'createCallback',
|
||||||
'include',
|
'compose',
|
||||||
'inject',
|
'debounce',
|
||||||
'invoke',
|
'defer',
|
||||||
'map',
|
'delay',
|
||||||
'max',
|
'memoize',
|
||||||
'min',
|
'once',
|
||||||
'pluck',
|
'partial',
|
||||||
'reduce',
|
'partialRight',
|
||||||
'reduceRight',
|
'throttle',
|
||||||
'reject',
|
'wrap'
|
||||||
'select',
|
],
|
||||||
'shuffle',
|
'Objects': [
|
||||||
'size',
|
'assign',
|
||||||
'some',
|
'clone',
|
||||||
'sortBy',
|
'cloneDeep',
|
||||||
'toArray',
|
'defaults',
|
||||||
'where'
|
'findKey',
|
||||||
];
|
'forIn',
|
||||||
|
'forOwn',
|
||||||
/** List of "Functions" category methods */
|
'functions',
|
||||||
var functionsMethods = [
|
'has',
|
||||||
'after',
|
'invert',
|
||||||
'bind',
|
'isArguments',
|
||||||
'bindAll',
|
'isArray',
|
||||||
'bindKey',
|
'isBoolean',
|
||||||
'createCallback',
|
'isDate',
|
||||||
'compose',
|
'isElement',
|
||||||
'debounce',
|
'isEmpty',
|
||||||
'defer',
|
'isEqual',
|
||||||
'delay',
|
'isFinite',
|
||||||
'memoize',
|
'isFunction',
|
||||||
'once',
|
'isNaN',
|
||||||
'partial',
|
'isNull',
|
||||||
'partialRight',
|
'isNumber',
|
||||||
'throttle',
|
'isObject',
|
||||||
'wrap'
|
'isPlainObject',
|
||||||
];
|
'isRegExp',
|
||||||
|
'isString',
|
||||||
/** List of "Objects" category methods */
|
'isUndefined',
|
||||||
var objectsMethods = [
|
'keys',
|
||||||
'assign',
|
'merge',
|
||||||
'clone',
|
'omit',
|
||||||
'cloneDeep',
|
'pairs',
|
||||||
'defaults',
|
'pick',
|
||||||
'extend',
|
'transform',
|
||||||
'findKey',
|
'values'
|
||||||
'forIn',
|
],
|
||||||
'forOwn',
|
'Utilities': [
|
||||||
'functions',
|
'escape',
|
||||||
'has',
|
'identity',
|
||||||
'invert',
|
'mixin',
|
||||||
'isArguments',
|
'noConflict',
|
||||||
'isArray',
|
'parseInt',
|
||||||
'isBoolean',
|
'random',
|
||||||
'isDate',
|
'result',
|
||||||
'isElement',
|
'runInContext',
|
||||||
'isEmpty',
|
'template',
|
||||||
'isEqual',
|
'times',
|
||||||
'isFinite',
|
'unescape',
|
||||||
'isFunction',
|
'uniqueId'
|
||||||
'isNaN',
|
]
|
||||||
'isNull',
|
};
|
||||||
'isNumber',
|
|
||||||
'isObject',
|
|
||||||
'isPlainObject',
|
|
||||||
'isRegExp',
|
|
||||||
'isString',
|
|
||||||
'isUndefined',
|
|
||||||
'keys',
|
|
||||||
'methods',
|
|
||||||
'merge',
|
|
||||||
'omit',
|
|
||||||
'pairs',
|
|
||||||
'pick',
|
|
||||||
'transform',
|
|
||||||
'values'
|
|
||||||
];
|
|
||||||
|
|
||||||
/** List of "Utilities" category methods */
|
|
||||||
var utilityMethods = [
|
|
||||||
'escape',
|
|
||||||
'identity',
|
|
||||||
'mixin',
|
|
||||||
'noConflict',
|
|
||||||
'parseInt',
|
|
||||||
'random',
|
|
||||||
'result',
|
|
||||||
'runInContext',
|
|
||||||
'template',
|
|
||||||
'times',
|
|
||||||
'unescape',
|
|
||||||
'uniqueId'
|
|
||||||
];
|
|
||||||
|
|
||||||
/** List of Backbone's Lo-Dash dependencies */
|
/** List of Backbone's Lo-Dash dependencies */
|
||||||
var backboneDependencies = [
|
var backboneDependencies = [
|
||||||
@@ -299,8 +268,8 @@
|
|||||||
'without'
|
'without'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** List of Lo-Dash only methods */
|
/** List of Lo-Dash only functions */
|
||||||
var lodashOnlyMethods = [
|
var lodashOnlyFuncs = [
|
||||||
'at',
|
'at',
|
||||||
'bindKey',
|
'bindKey',
|
||||||
'cloneDeep',
|
'cloneDeep',
|
||||||
@@ -318,11 +287,16 @@
|
|||||||
'unzip'
|
'unzip'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** List of all Lo-Dash methods */
|
/** List of all functions */
|
||||||
var lodashMethods = allMethods.slice();
|
var allFuncs = _.functions(_).filter(function(funcName) {
|
||||||
|
return !/^_/.test(funcName);
|
||||||
|
});
|
||||||
|
|
||||||
/** List of Underscore methods */
|
/** List of all Lo-Dash functions */
|
||||||
var underscoreMethods = _.difference(allMethods, lodashOnlyMethods);
|
var lodashFuncs = allFuncs.slice();
|
||||||
|
|
||||||
|
/** List of Underscore functions */
|
||||||
|
var underscoreFuncs = _.difference(allFuncs, lodashOnlyFuncs);
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -351,15 +325,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands a list of method names to include real and alias names.
|
* Expands a list of function names to include real and alias names.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} methodNames The array of method names to expand.
|
* @param {Array} funcNames The array of function names to expand.
|
||||||
* @returns {Array} Returns a new array of expanded method names.
|
* @returns {Array} Returns a new array of expanded function names.
|
||||||
*/
|
*/
|
||||||
function expandMethodNames(methodNames) {
|
function expandFuncNames(funcNames) {
|
||||||
return methodNames.reduce(function(result, methodName) {
|
return funcNames.reduce(function(result, funcName) {
|
||||||
var realName = getRealName(methodName);
|
var realName = getRealName(funcName);
|
||||||
push.apply(result, [realName].concat(getAliases(realName)));
|
push.apply(result, [realName].concat(getAliases(realName)));
|
||||||
return result;
|
return result;
|
||||||
}, []);
|
}, []);
|
||||||
@@ -376,31 +350,6 @@
|
|||||||
return realToAliasMap[funcName] || [];
|
return realToAliasMap[funcName] || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the names of methods belonging to the given `category`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {String} category The category to filter by.
|
|
||||||
* @returns {Array} Returns a new array of method names belonging to the given category.
|
|
||||||
*/
|
|
||||||
function getMethodsByCategory(category) {
|
|
||||||
switch (category) {
|
|
||||||
case 'Arrays':
|
|
||||||
return arraysMethods.slice();
|
|
||||||
case 'Chaining':
|
|
||||||
return chainingMethods.slice();
|
|
||||||
case 'Collections':
|
|
||||||
return collectionsMethods.slice();
|
|
||||||
case 'Functions':
|
|
||||||
return functionsMethods.slice();
|
|
||||||
case 'Objects':
|
|
||||||
return objectsMethods.slice();
|
|
||||||
case 'Utilities':
|
|
||||||
return utilityMethods.slice();
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the real name, not alias, of a given function name.
|
* Gets the real name, not alias, of a given function name.
|
||||||
*
|
*
|
||||||
@@ -413,11 +362,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if a given method on the `lodash` object can be called successfully.
|
* Tests if a given method can be called successfully.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} lodash The built Lo-Dash object.
|
* @param {Object} lodash The built Lo-Dash object.
|
||||||
* @param {String} methodName The name of the Lo-Dash method to test.
|
* @param {String} funcName The name of the method to test.
|
||||||
* @param {String} message The unit test message.
|
* @param {String} message The unit test message.
|
||||||
*/
|
*/
|
||||||
function testMethod(lodash, methodName, message) {
|
function testMethod(lodash, methodName, message) {
|
||||||
@@ -430,7 +379,7 @@
|
|||||||
func = lodash[methodName];
|
func = lodash[methodName];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (_.contains(arraysMethods, methodName)) {
|
if (_.contains(arraysFuncs, methodName)) {
|
||||||
if (/(?:indexOf|sortedIndex|without)$/i.test(methodName)) {
|
if (/(?:indexOf|sortedIndex|without)$/i.test(methodName)) {
|
||||||
func(array, string);
|
func(array, string);
|
||||||
} else if (/^(?:difference|intersection|union|uniq|zip)/.test(methodName)) {
|
} else if (/^(?:difference|intersection|union|uniq|zip)/.test(methodName)) {
|
||||||
@@ -441,10 +390,10 @@
|
|||||||
func(array);
|
func(array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_.contains(chainingMethods, methodName)) {
|
else if (_.contains(chainingFuncs, methodName)) {
|
||||||
lodash(array)[methodName](noop);
|
lodash(array)[methodName](noop);
|
||||||
}
|
}
|
||||||
else if (_.contains(collectionsMethods, methodName)) {
|
else if (_.contains(collectionsFuncs, methodName)) {
|
||||||
if (/^(?:count|group|sort)By$/.test(methodName)) {
|
if (/^(?:count|group|sort)By$/.test(methodName)) {
|
||||||
func(array, noop);
|
func(array, noop);
|
||||||
func(array, string);
|
func(array, string);
|
||||||
@@ -472,7 +421,7 @@
|
|||||||
func(object, noop, object);
|
func(object, noop, object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_.contains(functionsMethods, methodName)) {
|
else if (_.contains(functionsFuncs, methodName)) {
|
||||||
if (methodName == 'after') {
|
if (methodName == 'after') {
|
||||||
func(1, noop);
|
func(1, noop);
|
||||||
} else if (methodName == 'bindAll') {
|
} else if (methodName == 'bindAll') {
|
||||||
@@ -489,7 +438,7 @@
|
|||||||
func(noop);
|
func(noop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_.contains(objectsMethods, methodName)) {
|
else if (_.contains(categoryMap.Objects, methodName)) {
|
||||||
if (methodName == 'clone') {
|
if (methodName == 'clone') {
|
||||||
func(object);
|
func(object);
|
||||||
func(object, true);
|
func(object, true);
|
||||||
@@ -506,7 +455,7 @@
|
|||||||
func(object);
|
func(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_.contains(utilityMethods, methodName)) {
|
else if (_.contains(categoryMap.Utilities, methodName)) {
|
||||||
if (methodName == 'mixin') {
|
if (methodName == 'mixin') {
|
||||||
func({});
|
func({});
|
||||||
} else if (methodName == 'result') {
|
} else if (methodName == 'result') {
|
||||||
@@ -1060,8 +1009,8 @@
|
|||||||
vm.runInContext(data.source, context);
|
vm.runInContext(data.source, context);
|
||||||
var lodash = context._;
|
var lodash = context._;
|
||||||
|
|
||||||
_.each(lodashOnlyMethods.concat('assign'), function(methodName) {
|
_.each(lodashOnlyFuncs.concat('assign'), function(funcName) {
|
||||||
equal(lodash[methodName], undefined, '_.' + methodName + ' should not exist: ' + basename);
|
equal(lodash[funcName], undefined, '_.' + funcName + ' should not exist: ' + basename);
|
||||||
});
|
});
|
||||||
|
|
||||||
start();
|
start();
|
||||||
@@ -1100,8 +1049,8 @@
|
|||||||
vm.runInContext(data.source, context, true);
|
vm.runInContext(data.source, context, true);
|
||||||
var lodash = context._;
|
var lodash = context._;
|
||||||
|
|
||||||
_.each(index ? ['clone','cloneDeep'] : ['clone'], function(methodName) {
|
_.each(index ? ['clone','cloneDeep'] : ['clone'], function(funcName) {
|
||||||
var clone = (methodName == 'clone')
|
var clone = (funcName == 'clone')
|
||||||
? lodash.clone(array, true)
|
? lodash.clone(array, true)
|
||||||
: lodash.cloneDeep(array);
|
: lodash.cloneDeep(array);
|
||||||
|
|
||||||
@@ -1471,7 +1420,7 @@
|
|||||||
QUnit.module('underscore builds with lodash methods');
|
QUnit.module('underscore builds with lodash methods');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var methodNames = [
|
var funcNames = [
|
||||||
'assign',
|
'assign',
|
||||||
'bindKey',
|
'bindKey',
|
||||||
'clone',
|
'clone',
|
||||||
@@ -1530,22 +1479,22 @@
|
|||||||
.replace(/[\s;]/g, '');
|
.replace(/[\s;]/g, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
methodNames.forEach(function(methodName) {
|
funcNames.forEach(function(funcName) {
|
||||||
var command = 'underscore plus=' + methodName;
|
var command = 'underscore plus=' + funcName;
|
||||||
|
|
||||||
if (methodName == 'createCallback') {
|
if (funcName == 'createCallback') {
|
||||||
command += ',where';
|
command += ',where';
|
||||||
}
|
}
|
||||||
if (methodName == 'zip') {
|
if (funcName == 'zip') {
|
||||||
command += ',unzip';
|
command += ',unzip';
|
||||||
}
|
}
|
||||||
if (methodName != 'chain' && _.contains(chainingMethods.concat('mixin'), methodName)) {
|
if (funcName != 'chain' && _.contains(chainingFuncs.concat('mixin'), funcName)) {
|
||||||
command += ',chain';
|
command += ',chain';
|
||||||
}
|
}
|
||||||
if (_.contains(['isEqual', 'isPlainObject'], methodName)) {
|
if (_.contains(['isEqual', 'isPlainObject'], funcName)) {
|
||||||
command += ',forIn';
|
command += ',forIn';
|
||||||
}
|
}
|
||||||
if (_.contains(['contains', 'every', 'find', 'some', 'transform'], methodName)) {
|
if (_.contains(['contains', 'every', 'find', 'some', 'transform'], funcName)) {
|
||||||
command += ',forOwn';
|
command += ',forOwn';
|
||||||
}
|
}
|
||||||
asyncTest('`lodash ' + command +'`', function() {
|
asyncTest('`lodash ' + command +'`', function() {
|
||||||
@@ -1559,12 +1508,12 @@
|
|||||||
vm.runInContext(data.source, context, true);
|
vm.runInContext(data.source, context, true);
|
||||||
var lodash = context._;
|
var lodash = context._;
|
||||||
|
|
||||||
if (methodName == 'chain' || methodName == 'findWhere' || (methodName == 'defer' && global.setImmediate)) {
|
if (funcName == 'chain' || funcName == 'findWhere' || (funcName == 'defer' && global.setImmediate)) {
|
||||||
notEqual(strip(lodash[methodName]), strip(_[methodName]), basename);
|
notEqual(strip(lodash[funcName]), strip(_[funcName]), basename);
|
||||||
} else if (!/\.min$/.test(basename)) {
|
} else if (!/\.min$/.test(basename)) {
|
||||||
equal(strip(lodash[methodName]), strip(_[methodName]), basename);
|
equal(strip(lodash[funcName]), strip(_[funcName]), basename);
|
||||||
}
|
}
|
||||||
testMethod(lodash, methodName, basename);
|
testMethod(lodash, funcName, basename);
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1601,8 +1550,8 @@
|
|||||||
'underscore include=debounce,throttle plus=after minus=throttle'
|
'underscore include=debounce,throttle plus=after minus=throttle'
|
||||||
]
|
]
|
||||||
.concat(
|
.concat(
|
||||||
allMethods.map(function(methodName) {
|
allFuncs.map(function(funcName) {
|
||||||
return 'include=' + methodName;
|
return 'include=' + funcName;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1631,73 +1580,73 @@
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
// add method names explicitly
|
// add function names explicitly
|
||||||
if (/\binclude=/.test(command)) {
|
if (/\binclude=/.test(command)) {
|
||||||
var methodNames = command.match(/\binclude=(\S*)/)[1].split(/, */);
|
var funcNames = command.match(/\binclude=(\S*)/)[1].split(/, */);
|
||||||
}
|
}
|
||||||
if (/\bcategory=/.test(command)) {
|
if (/\bcategory=/.test(command)) {
|
||||||
var categories = command.match(/\bcategory=(\S*)/)[1].split(/, */);
|
var categories = command.match(/\bcategory=(\S*)/)[1].split(/, */);
|
||||||
methodNames = (methodNames || []).concat(categories.map(function(category) {
|
funcNames = (funcNames || []).concat(categories.map(function(category) {
|
||||||
return capitalize(category.toLowerCase());
|
return capitalize(category.toLowerCase());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
// add method names required by Backbone and Underscore builds
|
// add function names required by Backbone and Underscore builds
|
||||||
if (/\bbackbone\b/.test(command) && !methodNames) {
|
if (/\bbackbone\b/.test(command) && !funcNames) {
|
||||||
methodNames = backboneDependencies.slice();
|
funcNames = backboneDependencies.slice();
|
||||||
}
|
}
|
||||||
if (isUnderscore) {
|
if (isUnderscore) {
|
||||||
if (methodNames) {
|
if (funcNames) {
|
||||||
exposeAssign = _.contains(methodNames, 'assign');
|
exposeAssign = _.contains(funcNames, 'assign');
|
||||||
exposeZipObject = _.contains(methodNames, 'zipObject');
|
exposeZipObject = _.contains(funcNames, 'zipObject');
|
||||||
} else {
|
} else {
|
||||||
methodNames = underscoreMethods.slice();
|
funcNames = underscoreFuncs.slice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!methodNames) {
|
if (!funcNames) {
|
||||||
methodNames = lodashMethods.slice();
|
funcNames = lodashFuncs.slice();
|
||||||
}
|
}
|
||||||
if (/\bplus=/.test(command)) {
|
if (/\bplus=/.test(command)) {
|
||||||
var otherNames = command.match(/\bplus=(\S*)/)[1].split(/, */);
|
var otherNames = command.match(/\bplus=(\S*)/)[1].split(/, */);
|
||||||
methodNames = methodNames.concat(expandMethodNames(otherNames));
|
funcNames = funcNames.concat(expandFuncNames(otherNames));
|
||||||
}
|
}
|
||||||
if (/\bminus=/.test(command)) {
|
if (/\bminus=/.test(command)) {
|
||||||
otherNames = command.match(/\bminus=(\S*)/)[1].split(/, */);
|
otherNames = command.match(/\bminus=(\S*)/)[1].split(/, */);
|
||||||
methodNames = _.difference(methodNames, expandMethodNames(otherNames));
|
funcNames = _.difference(funcNames, expandFuncNames(otherNames));
|
||||||
}
|
}
|
||||||
if (/\bexclude=/.test(command)) {
|
if (/\bexclude=/.test(command)) {
|
||||||
otherNames = command.match(/\bexclude=(\S*)/)[1].split(/, */);
|
otherNames = command.match(/\bexclude=(\S*)/)[1].split(/, */);
|
||||||
methodNames = _.difference(methodNames, expandMethodNames(otherNames));
|
funcNames = _.difference(funcNames, expandFuncNames(otherNames));
|
||||||
}
|
}
|
||||||
|
|
||||||
// expand categories to method names
|
// expand categories to function names
|
||||||
methodNames.slice().forEach(function(category) {
|
funcNames.slice().forEach(function(category) {
|
||||||
var otherNames = getMethodsByCategory(category);
|
var otherNames = categoryMap[category];
|
||||||
|
|
||||||
// limit method names to those available for specific builds
|
// limit function names to those available for specific builds
|
||||||
otherNames = _.intersection(otherNames,
|
otherNames = _.intersection(otherNames,
|
||||||
isBackbone ? backboneDependencies :
|
isBackbone ? backboneDependencies :
|
||||||
isUnderscore ? underscoreMethods :
|
isUnderscore ? underscoreFuncs :
|
||||||
lodashMethods
|
lodashFuncs
|
||||||
);
|
);
|
||||||
|
|
||||||
if (otherNames.length) {
|
if (otherNames.length) {
|
||||||
methodNames = _.without(methodNames, category);
|
funcNames = _.without(funcNames, category);
|
||||||
push.apply(methodNames, otherNames);
|
push.apply(funcNames, otherNames);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// expand aliases and remove nonexistent and duplicate method names
|
// expand aliases and remove nonexistent and duplicate function names
|
||||||
methodNames = _.uniq(_.intersection(expandMethodNames(methodNames), allMethods));
|
funcNames = _.uniq(_.intersection(expandFuncNames(funcNames), allFuncs));
|
||||||
|
|
||||||
if (!exposeAssign) {
|
if (!exposeAssign) {
|
||||||
methodNames = _.without(methodNames, 'assign');
|
funcNames = _.without(funcNames, 'assign');
|
||||||
}
|
}
|
||||||
if (!exposeZipObject) {
|
if (!exposeZipObject) {
|
||||||
methodNames = _.without(methodNames, 'zipObject');
|
funcNames = _.without(funcNames, 'zipObject');
|
||||||
}
|
}
|
||||||
var lodash = context._ || {};
|
var lodash = context._ || {};
|
||||||
methodNames.forEach(function(methodName) {
|
funcNames.forEach(function(funcName) {
|
||||||
testMethod(lodash, methodName, basename);
|
testMethod(lodash, funcName, basename);
|
||||||
});
|
});
|
||||||
|
|
||||||
start();
|
start();
|
||||||
|
|||||||
Reference in New Issue
Block a user