Nodejs Array Join joinsub(array, sizediff)

Here you can find the source of joinsub(array, sizediff)

Method Source Code

// attach the .joinsub method to Array's prototype to call it on any array
Array.prototype.joinsub = function (array, sizediff) {
  // if the other array is a falsy value, return
  if (!array)//from   w  w  w  . jav a2s .  c  o m
    return null;

  var match = [];
  for (var i = 0; i < this.length; i++) {
    if (this[i].contains(array, sizediff)) {
      for (var j = 0; j < this[i].length; j++) {
        if (array.indexOf(this[i][j]) == -1) {
            match.push(this[i][j]);
        }
      }
    }
  }
  return match;
}

Related

  1. join()
    function foo(arr)
        var o2 = o;
        var y = 100;
        for (var i =0;i<10;i++)
            y += o2.x + arr;
        WScript.Echo(y);
    ...
    
  2. join(separator)
    Array.prototype.join = function(separator) {
      var s = new String();
      for (var i = 0, len = this.length; i < len; i++) {
        s += (i > 0) ? separator : "";
        s += (typeof this[i] == "object" && this[i].constructor === Array) ? this[i].join(separator) : this[i];
      return s;
    };
    
  3. joinModel(id_app,model,joinFields,fn)
    Array.prototype.joinModel = function(id_app,model,joinFields,fn){
      var array = this;  
      async.map(array,function(a,callback){
        async.map(joinFields,function(join,callback){
          var akey = join.akey;
          var bkey = join.bkey;
          var avalue = a[akey];
          var query = {id_app:id_app};
          query[bkey] = avalue;
    ...