|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
747 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * The base implementation of methods like `_.findKey` and `_.findLastKey`,
|
|---|
| 3 | * without support for iteratee shorthands, which iterates over `collection`
|
|---|
| 4 | * using `eachFunc`.
|
|---|
| 5 | *
|
|---|
| 6 | * @private
|
|---|
| 7 | * @param {Array|Object} collection The collection to inspect.
|
|---|
| 8 | * @param {Function} predicate The function invoked per iteration.
|
|---|
| 9 | * @param {Function} eachFunc The function to iterate over `collection`.
|
|---|
| 10 | * @returns {*} Returns the found element or its key, else `undefined`.
|
|---|
| 11 | */
|
|---|
| 12 | function baseFindKey(collection, predicate, eachFunc) {
|
|---|
| 13 | var result;
|
|---|
| 14 | eachFunc(collection, function(value, key, collection) {
|
|---|
| 15 | if (predicate(value, key, collection)) {
|
|---|
| 16 | result = key;
|
|---|
| 17 | return false;
|
|---|
| 18 | }
|
|---|
| 19 | });
|
|---|
| 20 | return result;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | module.exports = baseFindKey;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.