mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Bump to v4.1.0.
This commit is contained in:
30
_baseXor.js
Normal file
30
_baseXor.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var arrayPush = require('./_arrayPush'),
|
||||
baseDifference = require('./_baseDifference'),
|
||||
baseUniq = require('./_baseUniq');
|
||||
|
||||
/**
|
||||
* The base implementation of methods like `_.xor`, without support for
|
||||
* iteratee shorthands, that accepts an array of arrays to inspect.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} arrays The arrays to inspect.
|
||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
||||
* @param {Function} [comparator] The comparator invoked per element.
|
||||
* @returns {Array} Returns the new array of values.
|
||||
*/
|
||||
function baseXor(arrays, iteratee, comparator) {
|
||||
var index = -1,
|
||||
length = arrays.length;
|
||||
|
||||
while (++index < length) {
|
||||
var result = result
|
||||
? arrayPush(
|
||||
baseDifference(result, arrays[index], iteratee, comparator),
|
||||
baseDifference(arrays[index], result, iteratee, comparator)
|
||||
)
|
||||
: arrays[index];
|
||||
}
|
||||
return (result && result.length) ? baseUniq(result, iteratee, comparator) : [];
|
||||
}
|
||||
|
||||
module.exports = baseXor;
|
||||
Reference in New Issue
Block a user