source: node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 432 bytes
Line 
1import { sortedLastIndex } from './sortedLastIndex.mjs';
2import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs';
3
4function sortedLastIndexOf(array, value) {
5 if (!array?.length) {
6 return -1;
7 }
8 const index = sortedLastIndex(array, value) - 1;
9 if (index >= 0 && isEqualsSameValueZero(array[index], value)) {
10 return index;
11 }
12 return -1;
13}
14
15export { sortedLastIndexOf };
Note: See TracBrowser for help on using the repository browser.