-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Add static methods to created instance of HashSet:
-
merge -
intersect -
subtract
const hashSet = require('hash-set');
// Create Set class which compares objects with JSON.stringify
const JSONSet = hashSet(JSON.stringify);
const set1 = new JSONSet([{ a: 1 }, { b: 2 }]);
const set2 = new JSONSet([{ c: 3 }, { b: 2 }]);
JSONSet.merge(set1, set2); // [{ a: 1 }, { c: 3 }, { b: 2 }]
JSONSet.intersect(set1, set2); // [{ b: 2 }]
JSONSet.subtract(set1, set2); // [{ a: 1 }]qfox and jt3k
Metadata
Metadata
Assignees
Labels
No labels