CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
xorBy.js40 linesDownload Raw Back to lodash-es
1import arrayFilter from './_arrayFilter.js';2import baseIteratee from './_baseIteratee.js';3import baseRest from './_baseRest.js';4import baseXor from './_baseXor.js';5import isArrayLikeObject from './isArrayLikeObject.js';6import last from './last.js';7 8/**9 * This method is like `_.xor` except that it accepts `iteratee` which is10 * invoked for each element of each `arrays` to generate the criterion by11 * which by which they're compared. The order of result values is determined12 * by the order they occur in the arrays. The iteratee is invoked with one13 * argument: (value).14 *15 * @static16 * @memberOf _17 * @since 4.0.018 * @category Array19 * @param {...Array} [arrays] The arrays to inspect.20 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.21 * @returns {Array} Returns the new array of filtered values.22 * @example23 *24 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);25 * // => [1.2, 3.4]26 *27 * // The `_.property` iteratee shorthand.28 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');29 * // => [{ 'x': 2 }]30 */31var xorBy = baseRest(function(arrays) {32  var iteratee = last(arrays);33  if (isArrayLikeObject(iteratee)) {34    iteratee = undefined;35  }36  return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee, 2));37});38 39export default xorBy;40 
basant307/AI_Governance_Project · CoolFace