1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- var baseFindIndex = require('./_baseFindIndex'),
- baseIteratee = require('./_baseIteratee'),
- toInteger = require('./toInteger');
- var nativeMax = Math.max,
- nativeMin = Math.min;
- function findLastIndex(array, predicate, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = length - 1;
- if (fromIndex !== undefined) {
- index = toInteger(fromIndex);
- index = fromIndex < 0
- ? nativeMax(length + index, 0)
- : nativeMin(index, length - 1);
- }
- return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
- }
- module.exports = findLastIndex;
|