Nodejs Array Complement complement(a, b)

Here you can find the source of complement(a, b)

Method Source Code

Array.complement = function(a, b){
     return Array.minus(Array.union(a, b),Array.intersect(a, b));
};

Related

  1. complement()
    Array.prototype.each = function(fn){ 
    fn = fn || Function.K; 
    var a = []; 
    var args = Array.prototype.slice.call(arguments, 1); 
    for(var i = 0; i < this.length; i++){ 
        var res = fn.apply(this,[this[i],i].concat(args)); 
        if(res != null) a.push(res); 
    return a; 
    ...
    
  2. complement(b)
    Array.prototype.complement = function(b) {
      return a.minus(a.union(b), a.intersect(b));
    };