compare-sets
v1.0.1
Published
Given two sets, `compare-sets` will return sets of the added, retained, and removed items
Downloads
694
Readme
compare-sets
Given two sets, compare-sets will return sets of the added, retained, and removed items
Installation
npm install [--save] compare-sets
Usage
var oldSet = new Set([1, 2, 3, 4])
var newSet = new Set([2, 4, 5, 6])
compareSets(oldSet, newSet)
// {
// added: Set { 5, 6 },
// retained: Set { 2, 4 },
// remvoed: Set { 1, 3 }
// }
Caveats
This library assumes an environment with Set
available