Home

function: sortedLastIndex


sortedLastIndex(array: Array, value: *): number

This method is like `sortedIndex` except that it returns the highest index at which `value` should be inserted into `array` in order to maintain its sort order.

Example(s):

sortedLastIndex([4, 5, 5, 5, 6], 5)
// => 4

Params:

Name Type Attribute Description
array The sorted array to inspect.
value The value to evaluate.

Returns:

number

  {
    "comment": "/**\r\n * This method is like `sortedIndex` except that it returns the highest\r\n * index at which `value` should be inserted into `array` in order to\r\n * maintain its sort order.\r\n *\r\n * @since 3.0.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 * sortedLastIndex([4, 5, 5, 5, 6], 5)\r\n * // => 4\r\n */",
    "meta": {
        "range": [
            550,
            639
        ],
        "filename": "sortedLastIndex.js",
        "lineno": 19,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100008518",
            "name": "sortedLastIndex",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "value"
            ]
        }
    },
    "description": "This method is like `sortedIndex` except that it returns the highest\rindex at which `value` should be inserted into `array` in order to\rmaintain its sort order.",
    "since": "3.0.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": [
        "sortedLastIndex([4, 5, 5, 5, 6], 5)\r// => 4"
    ],
    "name": "sortedLastIndex",
    "longname": "sortedLastIndex",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000780",
    "___s": true,
    "filepath": "sortedLastIndex.js"
}