List of utility methods to do Array Complement
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; ... | |
complement(a, b)Array.complement = function(a, b){ return Array.minus(Array.union(a, b),Array.intersect(a, b)); }; | |
complement(b)Array.prototype.complement = function(b) { return a.minus(a.union(b), a.intersect(b)); }; |