Home

function: pull


pull(array: Array, values: *): Array

Removes all given values from `array` using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) for equality comparisons. **Note:** Unlike `without`, this method mutates `array`. Use `remove` to remove elements from an array by predicate.

Example(s):

const array = ['a', 'b', 'c', 'a', 'b', 'c']

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

Params:

Name Type Attribute Description
array The array to modify.
values The values to remove.

Returns:

Array

  {
    "comment": "/**\r\n * Removes all given values from `array` using\r\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\r\n * for equality comparisons.\r\n *\r\n * **Note:** Unlike `without`, this method mutates `array`. Use `remove`\r\n * to remove elements from an array by predicate.\r\n *\r\n * @since 2.0.0\r\n * @category Array\r\n * @param {Array} array The array to modify.\r\n * @param {...*} [values] The values to remove.\r\n * @returns {Array} Returns `array`.\r\n * @see pullAll, pullAllBy, pullAllWith, pullAt, remove, reject\r\n * @example\r\n *\r\n * const array = ['a', 'b', 'c', 'a', 'b', 'c']\r\n *\r\n * pull(array, 'a', 'c')\r\n * console.log(array)\r\n * // => ['b', 'b']\r\n */",
    "meta": {
        "range": [
            719,
            788
        ],
        "filename": "pull.js",
        "lineno": 25,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100007110",
            "name": "pull",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "values"
            ]
        }
    },
    "description": "Removes all given values from `array` using\r[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\rfor equality comparisons.\r\r**Note:** Unlike `without`, this method mutates `array`. Use `remove`\rto remove elements from an array by predicate.",
    "since": "2.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The array to modify.",
            "name": "array"
        },
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "optional": true,
            "variable": true,
            "description": "The values to remove.",
            "name": "values"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns `array`."
        }
    ],
    "see": [
        "pullAll, pullAllBy, pullAllWith, pullAt, remove, reject"
    ],
    "examples": [
        "const array = ['a', 'b', 'c', 'a', 'b', 'c']\r\rpull(array, 'a', 'c')\rconsole.log(array)\r// => ['b', 'b']"
    ],
    "name": "pull",
    "longname": "pull",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000653",
    "___s": true,
    "filepath": "pull.js"
}