2020-10-04 04:10:08 +03:00
|
|
|
/**********************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
2020-10-06 01:32:33 +03:00
|
|
|
**********************************************/ /* c8 ignore next 2 */
|
2020-10-04 04:10:08 +03:00
|
|
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
|
|
|
|
(function(require){ var module={} // make module AMD/node compatible...
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
2020-10-04 04:40:16 +03:00
|
|
|
// Set set operation shorthands...
|
|
|
|
|
Set.prototype.unite = function(other){
|
|
|
|
|
return new Set([...this, ...other]) }
|
|
|
|
|
Set.prototype.intersect = function(other){
|
|
|
|
|
var test = other.has ? 'has' : 'includes'
|
|
|
|
|
return new Set([...this]
|
|
|
|
|
.filter(function(e){ return other[test](e) })) }
|
|
|
|
|
Set.prototype.subtract = function(other){
|
|
|
|
|
other = new Set(other)
|
|
|
|
|
return new Set([...this]
|
|
|
|
|
.filter(function(e){ return !other.has(e) })) }
|
|
|
|
|
|
2020-10-04 04:10:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* vim:set ts=4 sw=4 : */ return module })
|