mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Add _.findIndex and _.findKey. [closes #199]
Former-commit-id: 5ac98b559e074082d4019cd30c27bface063f9c9
This commit is contained in:
@@ -97,6 +97,7 @@
|
||||
'compact',
|
||||
'difference',
|
||||
'drop',
|
||||
'findIndex',
|
||||
'first',
|
||||
'flatten',
|
||||
'head',
|
||||
@@ -187,6 +188,7 @@
|
||||
'cloneDeep',
|
||||
'defaults',
|
||||
'extend',
|
||||
'findKey',
|
||||
'forIn',
|
||||
'forOwn',
|
||||
'functions',
|
||||
@@ -293,6 +295,8 @@
|
||||
'bindKey',
|
||||
'cloneDeep',
|
||||
'createCallback',
|
||||
'findIndex',
|
||||
'findKey',
|
||||
'forIn',
|
||||
'forOwn',
|
||||
'isPlainObject',
|
||||
@@ -946,6 +950,8 @@
|
||||
'at',
|
||||
'bindKey',
|
||||
'createCallback',
|
||||
'findIndex',
|
||||
'findKey',
|
||||
'forIn',
|
||||
'forOwn',
|
||||
'isPlainObject',
|
||||
@@ -1362,6 +1368,9 @@
|
||||
isUnderscore = /backbone|underscore/.test(command),
|
||||
exposeAssign = !isUnderscore,
|
||||
exposeCreateCallback = !isUnderscore,
|
||||
exposeForIn = !isUnderscore,
|
||||
exposeForOwn = !isUnderscore,
|
||||
exposeIsPlainObject = !isUnderscore,
|
||||
exposeZipObject = !isUnderscore;
|
||||
|
||||
try {
|
||||
@@ -1418,12 +1427,24 @@
|
||||
// remove nonexistent and duplicate method names
|
||||
methodNames = _.uniq(_.intersection(allMethods, expandMethodNames(methodNames)));
|
||||
|
||||
if (isUnderscore) {
|
||||
methodNames = _.without.apply(_, [methodNames].concat(['findIndex', 'findKey']));
|
||||
}
|
||||
if (!exposeAssign) {
|
||||
methodNames = _.without(methodNames, 'assign');
|
||||
}
|
||||
if (!exposeCreateCallback) {
|
||||
methodNames = _.without(methodNames, 'createCallback');
|
||||
}
|
||||
if (!exposeForIn) {
|
||||
methodNames = _.without(methodNames, 'forIn');
|
||||
}
|
||||
if (!exposeForOwn) {
|
||||
methodNames = _.without(methodNames, 'forOwn');
|
||||
}
|
||||
if (!exposeIsPlainObject) {
|
||||
methodNames = _.without(methodNames, 'isPlainobject');
|
||||
}
|
||||
if (!exposeZipObject) {
|
||||
methodNames = _.without(methodNames, 'zipObject');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user