mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Remove semicolons.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import baseFindIndex from './.internal/baseFindIndex.js';
|
||||
import toInteger from './toInteger.js';
|
||||
import baseFindIndex from './.internal/baseFindIndex.js'
|
||||
import toInteger from './toInteger.js'
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
const nativeMax = Math.max;
|
||||
const nativeMin = Math.min;
|
||||
const nativeMax = Math.max
|
||||
const nativeMin = Math.min
|
||||
|
||||
/**
|
||||
* This method is like `findIndex` except that it iterates over elements
|
||||
@@ -22,24 +22,24 @@ const nativeMin = Math.min;
|
||||
* { 'user': 'barney', 'active': true },
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': false }
|
||||
* ];
|
||||
* ]
|
||||
*
|
||||
* findLastIndex(users, ({ user }) => user == 'pebbles');
|
||||
* findLastIndex(users, ({ user }) => user == 'pebbles')
|
||||
* // => 2
|
||||
*/
|
||||
function findLastIndex(array, predicate, fromIndex) {
|
||||
const length = array == null ? 0 : array.length;
|
||||
const length = array == null ? 0 : array.length
|
||||
if (!length) {
|
||||
return -1;
|
||||
return -1
|
||||
}
|
||||
let index = length - 1;
|
||||
let index = length - 1
|
||||
if (fromIndex !== undefined) {
|
||||
index = toInteger(fromIndex);
|
||||
index = toInteger(fromIndex)
|
||||
index = fromIndex < 0
|
||||
? nativeMax(length + index, 0)
|
||||
: nativeMin(index, length - 1);
|
||||
: nativeMin(index, length - 1)
|
||||
}
|
||||
return baseFindIndex(array, predicate, index, true);
|
||||
return baseFindIndex(array, predicate, index, true)
|
||||
}
|
||||
|
||||
export default findLastIndex;
|
||||
export default findLastIndex
|
||||
|
||||
Reference in New Issue
Block a user