@lesleh/sets
v0.6.0
Published
Implements set operations for JavaScript Set objects.
Downloads
2
Readme
Sets
Implements set operations for JavaScript Set objects.
Installation
npm install @lesleh/sets
Functions
areDisjoint(set1, set2)
: Returns true if the two sets are disjoint (i.e. have no elements in common).difference(set1, set2)
: Returns the difference of the two sets.areEqual(set1, set2)
: Returns true if the two sets are equal.intersection(set1, set2)
: Returns the intersection of the two sets.union(set1, set2)
: Returns the union of the two sets.
Usage
import { areEqual } from '@lesleh/sets';
const set1 = new Set([1, 2, 3]);
const set2 = new Set([3, 2, 1]);
console.log(equal(set1, set2)); // true