Nodejs Array Value aggregate(initialValue, aggregateItemCallback)

Here you can find the source of aggregate(initialValue, aggregateItemCallback)

Method Source Code

Array.prototype.aggregate = function (initialValue, aggregateItemCallback) {
   var result = initialValue; 
   this.each(function (item) {
      result = aggregateItemCallback(result, item);
   })/*from   ww w  . ja  v  a2 s . c o  m*/
   
   return result;
}

Related

  1. allValuesSame()
    Array.prototype.allValuesSame = function() {
        for(var i = 1; i < this.length; i++)
            if(this[i] !== this[0])
                return false;
        return true;
    
  2. allValuesSame()
    Array.prototype.allValuesSame = function() {
      for(var i = 1; i < this.length; i++)
        if(this[i] !== this[0])
          return false;
      return true;
    
  3. allValuesSame()
    var canvas = {};
    Array.prototype.allValuesSame = function() {
      for(var i = 1; i < this.length; i++) {
          if(this[i] !== this[0])
              return false;
      return true;
    
  4. byField(field, value)
    Array.prototype.byField = function(field, value) {
      return this.filter(function ( obj ) {
        return obj[field] == value;
      })[0]