UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

33 lines (32 loc) 1.31 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const baseXor_1 = __importDefault(require("./.internal/baseXor")); const isArrayLikeObject_1 = __importDefault(require("./isArrayLikeObject")); const getIteratee_1 = __importDefault(require("./.internal/getIteratee")); /** * This method is like `xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by * which they're compared. The order of result values is determined * by the order they occur in the arrays. The iteratee is invoked with one * argument: (value). * * @since 5.9.0 * @category Array * @param arrays The arrays to inspect. * @param iteratee The iteratee invoked per element. * @returns Returns the new array of filtered values. * @see [[difference]],[[union]],[[unionBy]],[[unionWith]],[[without]],[[xor]],[[xorWith]] * @example * * ```js * xorBy([2.1, 1.2], [2.3, 3.4], Math.floor) * // => [1.2, 3.4] * ``` */ function xorBy(iteratee, ...arrays) { return (0, baseXor_1.default)(arrays.filter(isArrayLikeObject_1.default), (0, getIteratee_1.default)(iteratee, 2)); } exports.default = xorBy;