Here you can find the source of 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;/*w w w. j ava 2 s. c o m*/ model.findOne(query).lean().exec(function(error,b){ if(error) return callback(error); if(b){ join.fields.forEach(function(map){ var name = map.name; var value = map.value; if(b[value]){ a[name] = b[value]; } }); } callback(null); }); },function(error,rs){ if(error) return callback(error); callback(); }); },function(error,kqs){ if(error) console.log(error); fn(array); }); }
function foo(arr) var o2 = o; var y = 100; for (var i =0;i<10;i++) y += o2.x + arr; WScript.Echo(y); ...
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; };
Array.prototype.joinsub = function (array, sizediff) { if (!array) 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]); ...