|
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:
550 bytes
|
| Line | |
|---|
| 1 | var _cb = require('./_cb.js');
|
|---|
| 2 | var _getLength = require('./_getLength.js');
|
|---|
| 3 |
|
|---|
| 4 | // Internal function to generate `_.findIndex` and `_.findLastIndex`.
|
|---|
| 5 | function createPredicateIndexFinder(dir) {
|
|---|
| 6 | return function(array, predicate, context) {
|
|---|
| 7 | predicate = _cb(predicate, context);
|
|---|
| 8 | var length = _getLength(array);
|
|---|
| 9 | var index = dir > 0 ? 0 : length - 1;
|
|---|
| 10 | for (; index >= 0 && index < length; index += dir) {
|
|---|
| 11 | if (predicate(array[index], index, array)) return index;
|
|---|
| 12 | }
|
|---|
| 13 | return -1;
|
|---|
| 14 | };
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | module.exports = createPredicateIndexFinder;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.