Home

function: pullAt


pullAt(array: Array, indexes: number, Array.<number>): Array

Removes elements from `array` corresponding to `indexes` and returns an array of removed elements. **Note:** Unlike `at`, this method mutates `array`.

Example(s):

const array = ['a', 'b', 'c', 'd']
const pulled = pullAt(array, [1, 3])

console.log(array)
// => ['a', 'c']

console.log(pulled)
// => ['b', 'd']

Params:

Name Type Attribute Description
array The array to modify.
indexes The indexes of elements to remove.

Returns:

Array

  {
    "comment": "/**\r\n * Removes elements from `array` corresponding to `indexes` and returns an\r\n * array of removed elements.\r\n *\r\n * **Note:** Unlike `at`, this method mutates `array`.\r\n *\r\n * @since 3.0.0\r\n * @category Array\r\n * @param {Array} array The array to modify.\r\n * @param {...(number|number[])} [indexes] The indexes of elements to remove.\r\n * @returns {Array} Returns the new array of removed elements.\r\n * @see pull, pullAll, pullAllBy, pullAllWith, remove, reject\r\n * @example\r\n *\r\n * const array = ['a', 'b', 'c', 'd']\r\n * const pulled = pullAt(array, [1, 3])\r\n *\r\n * console.log(array)\r\n * // => ['a', 'c']\r\n *\r\n * console.log(pulled)\r\n * // => ['b', 'd']\r\n */",
    "meta": {
        "range": [
            920,
            1185
        ],
        "filename": "pullAt.js",
        "lineno": 30,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100007251",
            "name": "pullAt",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "indexes"
            ]
        },
        "vars": {
            "length": "pullAt~length",
            "result": "pullAt~result",
            "": null
        }
    },
    "description": "Removes elements from `array` corresponding to `indexes` and returns an\rarray of removed elements.\r\r**Note:** Unlike `at`, this method mutates `array`.",
    "since": "3.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The array to modify.",
            "name": "array"
        },
        {
            "type": {
                "names": [
                    "number",
                    "Array."
                ]
            },
            "optional": true,
            "variable": true,
            "description": "The indexes of elements to remove.",
            "name": "indexes"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the new array of removed elements."
        }
    ],
    "see": [
        "pull, pullAll, pullAllBy, pullAllWith, remove, reject"
    ],
    "examples": [
        "const array = ['a', 'b', 'c', 'd']\rconst pulled = pullAt(array, [1, 3])\r\rconsole.log(array)\r// => ['a', 'c']\r\rconsole.log(pulled)\r// => ['b', 'd']"
    ],
    "name": "pullAt",
    "longname": "pullAt",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000661",
    "___s": true,
    "filepath": "pullAt.js"
}