This method is like `indexOf` except that it performs a binary search on a sorted `array`.
sortedIndexOf([4, 5, 5, 5, 6], 5)
// => 1
Name | Type | Attribute | Description |
---|---|---|---|
array | The array to inspect. | ||
value | The value to search for. |
{ "comment": "/**\r\n * This method is like `indexOf` except that it performs a binary\r\n * search on a sorted `array`.\r\n *\r\n * @since 4.0.0\r\n * @category Array\r\n * @param {Array} array The array to inspect.\r\n * @param {*} value The value to search for.\r\n * @returns {number} Returns the index of the matched value, else `-1`.\r\n * @example\r\n *\r\n * sortedIndexOf([4, 5, 5, 5, 6], 5)\r\n * // => 1\r\n */", "meta": { "range": [ 473, 730 ], "filename": "sortedIndexOf.js", "lineno": 18, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100008468", "name": "sortedIndexOf", "type": "FunctionDeclaration", "paramnames": [ "array", "value" ] }, "vars": { "length": "sortedIndexOf~length", "index": "sortedIndexOf~index" } }, "description": "This method is like `indexOf` except that it performs a binary\rsearch on a sorted `array`.", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Array", "value": "Array" } ], "params": [ { "type": { "names": [ "Array" ] }, "description": "The array to inspect.", "name": "array" }, { "type": { "names": [ "*" ] }, "description": "The value to search for.", "name": "value" } ], "returns": [ { "type": { "names": [ "number" ] }, "description": "Returns the index of the matched value, else `-1`." } ], "examples": [ "sortedIndexOf([4, 5, 5, 5, 6], 5)\r// => 1" ], "name": "sortedIndexOf", "longname": "sortedIndexOf", "kind": "function", "scope": "global", "___id": "T000002R000776", "___s": true, "filepath": "sortedIndexOf.js" }