Nodejs Array Exclude excludeBlock(excludeArray)

Here you can find the source of excludeBlock(excludeArray)

Method Source Code

Array.prototype.excludeBlock = function (excludeArray) {
   var newArray = [];
   for (var i=0; i<this.length; i++) {
      var found = false;
      for (var j=0; j<excludeArray.length; j++) {
         if (this[i]===excludeArray[j]) {
            found = true;// w w  w. j  av a2 s .c  o m
         } else {
            if(Experigen && Experigen.resources && Experigen.resources.items && this[i][Experigen.resources.items.key]===excludeArray[j][Experigen.resources.items.key]) {
               found = true;
            }
         }
      }
      if (!found) {
         newArray.push(this[i]);
      }
   }
   return newArray;
}

Related

  1. exclude(e)
    Array.prototype.exclude = function(e) {
      var rst = [];
      for (var i = 0; i < this.length; ++i) {
        if (e != this[i])
          rst.push(this[i]);
      return rst;
    
  2. exclude(field, criterion)
    Array.prototype.exclude = function (field, criterion) {
      var arr = new Array();
      for (var i=0 ; i<this.length ; i++) {
        if(this[i][field] !== criterion) {
          arr.push(this[i]);
      return arr;
    
  3. excludeFirst(i)
    Array.prototype.excludeFirst = function (i) {
        if (!i) {
          return this.slice(1,this.length);
        } else {
          return this.slice(i,this.length);
    
  4. excludes(elem)
    Array.prototype.excludes = function(elem) {
        var pos = this.indexOf(elem);
        if (pos != -1) 
            this.splice(pos, 1);
    
  5. excludesArray(arr)
    Array.prototype.excludesArray = function(arr) {
        var pos = this.containsArray(arr);
        if (pos != -1)
            this.splice(pos, 1);
    
  6. excluding(item)
    Array.prototype.excluding = function(item) {
        return this.slice(0).remove(item);