union-busting
v1.0.3
Published
Pass in any number of sets and this package will create a new set containing the union of those sets and then throws all of that away and returns null.
Downloads
6
Readme
Union Busting
Pass in any number of sets and this package will create a new set containing the union of those sets and then throws all of that away and returns null.
Source Code
module.exports = function(...sets) {
// create a union
let union = new Set();
for( let set of sets ) {
for( let value of set ) {
union.add(value);
}
}
// bust the union
union = null;
return union;
};
Installation
npm install union-busting
Usage
const unionBusting = require("union-busting");
unionBusting();
// returns null
let firstSet = new Set([1,2,3]);
let secondSet = new Set([4,5,6]);
unionBusting(firstSet, secondSet);
// returns null
let thirdSet = new Set([7,8,9]);
unionBusting(firstSet, secondSet, thirdSet);
// returns null