Home

function: pullAllWith


pullAllWith(array: Array, values: Array, comparator: function): Array

This method is like `pullAll` except that it accepts `comparator` which is invoked to compare elements of `array` to `values`. The comparator is invoked with two arguments: (arrVal, othVal). **Note:** Unlike `differenceWith`, this method mutates `array`.

Example(s):

const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]

pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)
console.log(array)
// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]

Params:

Name Type Attribute Description
array The array to modify.
values The values to remove.
comparator The comparator invoked per element.

Returns:

Array

  {
    "comment": "/**\r\n * This method is like `pullAll` except that it accepts `comparator` which\r\n * is invoked to compare elements of `array` to `values`. The comparator is\r\n * invoked with two arguments: (arrVal, othVal).\r\n *\r\n * **Note:** Unlike `differenceWith`, this method mutates `array`.\r\n *\r\n * @since 4.6.0\r\n * @category Array\r\n * @param {Array} array The array to modify.\r\n * @param {Array} values The values to remove.\r\n * @param {Function} [comparator] The comparator invoked per element.\r\n * @returns {Array} Returns `array`.\r\n * @see pull, pullAll, pullAllBy, pullAt, remove, reject\r\n * @example\r\n *\r\n * const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]\r\n *\r\n * pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)\r\n * console.log(array)\r\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\r\n */",
    "meta": {
        "range": [
            871,
            1070
        ],
        "filename": "pullAllWith.js",
        "lineno": 25,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100007198",
            "name": "pullAllWith",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "values",
                "comparator"
            ]
        }
    },
    "description": "This method is like `pullAll` except that it accepts `comparator` which\ris invoked to compare elements of `array` to `values`. The comparator is\rinvoked with two arguments: (arrVal, othVal).\r\r**Note:** Unlike `differenceWith`, this method mutates `array`.",
    "since": "4.6.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The array to modify.",
            "name": "array"
        },
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The values to remove.",
            "name": "values"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "optional": true,
            "description": "The comparator invoked per element.",
            "name": "comparator"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns `array`."
        }
    ],
    "see": [
        "pull, pullAll, pullAllBy, pullAt, remove, reject"
    ],
    "examples": [
        "const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]\r\rpullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)\rconsole.log(array)\r// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]"
    ],
    "name": "pullAllWith",
    "longname": "pullAllWith",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000659",
    "___s": true,
    "filepath": "pullAllWith.js"
}