build/rekord.js
function(numbers)
  {
    var resolver = createNumberResolver( numbers );
    var result = 0;
    var total = 0;

    function process(x)
    {
      result += x;
      total++;
    }

    function getResult()
    {
      return total === 0 ? 0 : result / total;
    }

    return this.aggregate( resolver, isNumber, process, getResult );
  }
function(numbers)
  {
    var resolver = createNumberResolver( numbers );
    var result = 0;
    var total = 0;

    function process(x)
    {
      result += x;
      total++;
    }

    function getResult()
    {
      return total === 0 ? 0 : result / total;
    }

    return this.aggregate( resolver, isNumber, process, getResult );
  }
function ( numbers ) { var resolver = createNumberResolver ( numbers ) ; var result = 0 ; var total = 0 ; function process ( x ) { result += x ; total ++ ; } function getResult ( ) { return total === 0 ? 0 : result / total ; } return this . aggregate ( resolver , isNumber , process , getResult ) ; }
Averages all numbers resolved from the given property expression and
returns the result.

```javascript
var c = Rekord.collect([2, 3, 4]);
c.avg(); // 3
var d = Rekord.collect([{age: 5}, {age: 4}, {age: 2}]);
d.avg('age'); // 3.66666
```

@method
@memberof Rekord.Collection#
@param {propertyResolverInput} [numbers]
The expression which converts an element in this collection to a number.
@return {Number} -
The average of all valid numbers found in this collection.
@see Rekord.createNumberResolver
Averages all numbers resolved from the given property expression and returns the result .