lodash xor array method aka symmetric difference
1.1 - Basic xor example
For a basic example of the lodash xor method consider two arrays one with elements that are the numbers [0,1], and another with the numbers [1,2]. If the arrays are given to the lodash xor method the resulting array should be [0,2]
1.2 - Three or more arrays
It is then possible to pass as many arrays that I want as arguments to the xor function. In the first basic example I was just starting out with two, but in this one I am now dealing with three. The result is the same though the values that are returned in the resulting arrays will be cuase that show up in just one, bit not two or more of the additional arrays.
There is the question of how to go about feeding an array of arrays to this xor method, or any other method that works like this. Also if there is an xor method that will give my an array of values that are values that only show up once in one array then there should be a method that will return values that show up in all of the arrays. So lets look at a few more examples that will help with that and much more while we are at it here.
1.3 - Sort
The order of the values will change form one use case to another depending on the order in which the arrays are given. In mode cases this is not a problem, but if for some reason it is a problem the values will need to be sorted. One way to do so with lodash method would be to make use of the lodash sort by method.
1.4 - The apply Function prototype method
If I want to use an array of arrays, then one way to go about doing so with the lodash xor method would be to use the apply method of the function prototype.
1.5 - The lodash intersection method
The lodash intersection method is then the method that I would want to use in order to get an array of values that show up in each of the given arrays of values.
2 - Looking under the hood with this one in the lodash source code
As a lodash end user I often just call methods like _.xor, get the result that I want, and then move on. However some times I take a look at the lodash source code to gain a deeper understanding and apprehension of what is going on with the lodash source code. Even if you do not use lodash, or maybe just a method or two now and then at all, the lodash source code is still worth checking out when it comes to reading code.
I was able to get a similar result by copying and pasting in much of the lodash internals like this.
3 - Conclusion