Uses a binary search to determine the lowest index at which `value` should be inserted into `array` in order to maintain its sort order.
sortedIndex([30, 50], 40)
// => 1
| Name | Type | Attribute | Description |
|---|---|---|---|
| array | The sorted array to inspect. | ||
| value | The value to evaluate. |
{
"comment": "/**\r\n * Uses a binary search to determine the lowest index at which `value`\r\n * should be inserted into `array` in order to maintain its sort order.\r\n *\r\n * @since 0.1.0\r\n * @category Array\r\n * @param {Array} array The sorted array to inspect.\r\n * @param {*} value The value to evaluate.\r\n * @returns {number} Returns the index at which `value` should be inserted\r\n * into `array`.\r\n * @example\r\n *\r\n * sortedIndex([30, 50], 40)\r\n * // => 1\r\n */",
"meta": {
"range": [
512,
591
],
"filename": "sortedIndex.js",
"lineno": 18,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100008428",
"name": "sortedIndex",
"type": "FunctionDeclaration",
"paramnames": [
"array",
"value"
]
}
},
"description": "Uses a binary search to determine the lowest index at which `value`\rshould be inserted into `array` in order to maintain its sort order.",
"since": "0.1.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Array",
"value": "Array"
}
],
"params": [
{
"type": {
"names": [
"Array"
]
},
"description": "The sorted array to inspect.",
"name": "array"
},
{
"type": {
"names": [
"*"
]
},
"description": "The value to evaluate.",
"name": "value"
}
],
"returns": [
{
"type": {
"names": [
"number"
]
},
"description": "Returns the index at which `value` should be inserted\r into `array`."
}
],
"examples": [
"sortedIndex([30, 50], 40)\r// => 1"
],
"name": "sortedIndex",
"longname": "sortedIndex",
"kind": "function",
"scope": "global",
"___id": "T000002R000772",
"___s": true,
"filepath": "sortedIndex.js"
}