Home

function: union


union(arrays: Array): Array

Creates an array of unique values, in order, from all given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) for equality comparisons.

Example(s):

union([2], [1, 2])
// => [2, 1]

Params:

Name Type Attribute Description
arrays The arrays to inspect.

Returns:

Array

  {
    "comment": "/**\r\n * Creates an array of unique values, in order, from all given arrays using\r\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\r\n * for equality comparisons.\r\n *\r\n * @since 0.1.0\r\n * @category Array\r\n * @param {...Array} [arrays] The arrays to inspect.\r\n * @returns {Array} Returns the new array of combined values.\r\n * @see difference, unionBy, unionWith, without, xor, xorBy\r\n * @example\r\n *\r\n * union([2], [1, 2])\r\n * // => [2, 1]\r\n */",
    "meta": {
        "range": [
            638,
            736
        ],
        "filename": "union.js",
        "lineno": 20,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100011085",
            "name": "union",
            "type": "FunctionDeclaration",
            "paramnames": [
                "arrays"
            ]
        }
    },
    "description": "Creates an array of unique values, in order, from all given arrays using\r[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\rfor equality comparisons.",
    "since": "0.1.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "optional": true,
            "variable": true,
            "description": "The arrays to inspect.",
            "name": "arrays"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the new array of combined values."
        }
    ],
    "see": [
        "difference, unionBy, unionWith, without, xor, xorBy"
    ],
    "examples": [
        "union([2], [1, 2])\r// => [2, 1]"
    ],
    "name": "union",
    "longname": "union",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R001007",
    "___s": true,
    "filepath": "union.js"
}