Plugin details
Compares items in two lists (List 1 and List 2) removing any individual item found in both lists from List 1 and returning the remaining items.
Example:
If List 1 = [1,1,2,3] and List 2 = [1,2,3,3,3], Reconciler will return [1].
In the opposite case, List 1 = [1,2,3,3,3] and List 2 = [1,1,2,3], Reconciler will return [3, 3].
The algorithm implemented is exactly the following:
function reconcile(list1, list2) {
var arr1 = [...list1], arr2 = [...list2]
arr2.forEach(item => {
var index = arr1.indexOf(item)
index > -1 && arr1.splice(index, 1)
})
return arr1
}