Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
626 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var baseSortedIndex = require('./_baseSortedIndex');
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Uses a binary search to determine the lowest index at which `value`
|
---|
| 5 | * should be inserted into `array` in order to maintain its sort order.
|
---|
| 6 | *
|
---|
| 7 | * @static
|
---|
| 8 | * @memberOf _
|
---|
| 9 | * @since 0.1.0
|
---|
| 10 | * @category Array
|
---|
| 11 | * @param {Array} array The sorted array to inspect.
|
---|
| 12 | * @param {*} value The value to evaluate.
|
---|
| 13 | * @returns {number} Returns the index at which `value` should be inserted
|
---|
| 14 | * into `array`.
|
---|
| 15 | * @example
|
---|
| 16 | *
|
---|
| 17 | * _.sortedIndex([30, 50], 40);
|
---|
| 18 | * // => 1
|
---|
| 19 | */
|
---|
| 20 | function sortedIndex(array, value) {
|
---|
| 21 | return baseSortedIndex(array, value);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | module.exports = sortedIndex;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.