UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

33 lines (32 loc) 1.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.xor = void 0; // @ts-nocheck const baseXor_1 = __importDefault(require("./.internal/baseXor")); const isArrayLikeObject_1 = __importDefault(require("./isArrayLikeObject")); /** * Creates an array of unique values that is the * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the given arrays. The order of result values is determined by the order * they occur in the arrays. * * @since 5.7.0 * @category Array * @param arrays [] The arrays to inspect. * @returns Array Returns the new array of filtered values. * @see [[difference]],[[union]],[[unionBy]],[[unionWith]],[[without]],[[xorBy]],[[xorWith]] * @example * * ```js * xor([2, 1], [2, 3]) * // => [1, 3] * ``` */ function xor(...arrays) { return (0, baseXor_1.default)(arrays.filter(isArrayLikeObject_1.default)); } exports.xor = xor; exports.default = xor;