|
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 | |
|---|
| 1 | import { sortedLastIndex } from './sortedLastIndex.mjs';
|
|---|
| 2 | import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs';
|
|---|
| 3 |
|
|---|
| 4 | function 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 |
|
|---|
| 15 | export { sortedLastIndexOf };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.