|
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:
766 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|---|
| 3 | * support for iteratee shorthands.
|
|---|
| 4 | *
|
|---|
| 5 | * @private
|
|---|
| 6 | * @param {Array} array The array to inspect.
|
|---|
| 7 | * @param {Function} predicate The function invoked per iteration.
|
|---|
| 8 | * @param {number} fromIndex The index to search from.
|
|---|
| 9 | * @param {boolean} [fromRight] Specify iterating from right to left.
|
|---|
| 10 | * @returns {number} Returns the index of the matched value, else `-1`.
|
|---|
| 11 | */
|
|---|
| 12 | function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|---|
| 13 | var length = array.length,
|
|---|
| 14 | index = fromIndex + (fromRight ? 1 : -1);
|
|---|
| 15 |
|
|---|
| 16 | while ((fromRight ? index-- : ++index < length)) {
|
|---|
| 17 | if (predicate(array[index], index, array)) {
|
|---|
| 18 | return index;
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 | return -1;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | module.exports = baseFindIndex;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.