Home

function: sortedIndexBy


sortedIndexBy(array: Array, value: *, iteratee: function): number

This method is like `sortedIndex` except that it accepts `iteratee` which is invoked for `value` and each element of `array` to compute their sort ranking. The iteratee is invoked with one argument: (value).

Example(s):

const objects = [{ 'n': 4 }, { 'n': 5 }]

sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n)
// => 0

Params:

Name Type Attribute Description
array The sorted array to inspect.
value The value to evaluate.
iteratee The iteratee invoked per element.

Returns:

number

  {
    "comment": "/**\r\n * This method is like `sortedIndex` except that it accepts `iteratee`\r\n * which is invoked for `value` and each element of `array` to compute their\r\n * sort ranking. The iteratee is invoked with one argument: (value).\r\n *\r\n * @since 4.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 * @param {Function} iteratee The iteratee invoked per element.\r\n * @returns {number} Returns the index at which `value` should be inserted\r\n *  into `array`.\r\n * @example\r\n *\r\n * const objects = [{ 'n': 4 }, { 'n': 5 }]\r\n *\r\n * sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n)\r\n * // => 0\r\n */",
    "meta": {
        "range": [
            728,
            831
        ],
        "filename": "sortedIndexBy.js",
        "lineno": 22,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100008445",
            "name": "sortedIndexBy",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "value",
                "iteratee"
            ]
        }
    },
    "description": "This method is like `sortedIndex` except that it accepts `iteratee`\rwhich is invoked for `value` and each element of `array` to compute their\rsort ranking. The iteratee is invoked with one argument: (value).",
    "since": "4.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"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The iteratee invoked per element.",
            "name": "iteratee"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "number"
                ]
            },
            "description": "Returns the index at which `value` should be inserted\r into `array`."
        }
    ],
    "examples": [
        "const objects = [{ 'n': 4 }, { 'n': 5 }]\r\rsortedIndexBy(objects, { 'n': 4 }, ({ n }) => n)\r// => 0"
    ],
    "name": "sortedIndexBy",
    "longname": "sortedIndexBy",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000774",
    "___s": true,
    "filepath": "sortedIndexBy.js"
}