|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
418 bytes
|
| Line | |
|---|
| 1 | import { sortedIndex } from './sortedIndex.mjs';
|
|---|
| 2 | import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs';
|
|---|
| 3 |
|
|---|
| 4 | function sortedIndexOf(array, value) {
|
|---|
| 5 | if (!array?.length) {
|
|---|
| 6 | return -1;
|
|---|
| 7 | }
|
|---|
| 8 | const index = sortedIndex(array, value);
|
|---|
| 9 | if (index < array.length && isEqualsSameValueZero(array[index], value)) {
|
|---|
| 10 | return index;
|
|---|
| 11 | }
|
|---|
| 12 | return -1;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | export { sortedIndexOf };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.