monk-import-export
Version:
Simple import & export sorting ESLint plugin
15 lines (14 loc) • 511 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findLastIndex = void 0;
// Like `Array.prototype.findIndex`, but searches from the end.
function findLastIndex(array, fn) {
for (let index = array.length - 1; index >= 0; index--) {
if (fn(array[index], index, array))
return index;
}
// There are currently no usages of `findLastIndex` where nothing is found.
// istanbul ignore next
return -1;
}
exports.findLastIndex = findLastIndex;