What is lodash.xorby?
The lodash.xorby package is a utility library that provides a method to create an array of unique values that is the symmetric difference of the given arrays, using a specified iteratee to generate the criterion by which uniqueness is computed.
Symmetric Difference with Iteratee
This feature allows you to compute the symmetric difference between two arrays, using an iteratee function to determine the criterion for uniqueness. In this example, the Math.floor function is used as the iteratee, so the comparison is done based on the floored values of the elements.
const xorBy = require('lodash.xorby');
const array1 = [2.1, 1.2];
const array2 = [2.3, 3.4];
const result = xorBy(array1, array2, Math.floor);
console.log(result); // Output: [1.2, 3.4]