code: function sma(arr, range, format) {
    if (!Array.isArray(arr)) {
      throw TypeError('expected first argument to be an array');
    }
  
    var fn = typeof format === 'function' ? format : toFixed;
    var num = range || arr.length;
    var res = [];
    var len = arr.length + 1;
    var idx = num - 1;
    while (++idx < len) {
      res.push(fn(avg(arr, idx, num)));
    }
    return res;
  }
docs: Calculate the simple moving average of an array. A new array is returned with the average
  of each range of elements. A range will only be calculated when it contains enough elements to fill the range.
  
  ```js
  console.log(sma([1, 2, 3, 4, 5, 6, 7, 8, 9], 4));
  //=> [ '2.50', '3.50', '4.50', '5.50', '6.50', '7.50' ]
  //=>   │       │       │       │       │       └─(6+7+8+9)/4
  //=>   │       │       │       │       └─(5+6+7+8)/4
  //=>   │       │       │       └─(4+5+6+7)/4
  //=>   │       │       └─(3+4+5+6)/4
  //=>   │       └─(2+3+4+5)/4
  //=>   └─(1+2+3+4)/4
  ```
  @param  {Array} `arr` Array of numbers to calculate.
  @param  {Number} `range` Size of the window to use to when calculating the average for each range. Defaults to array length.
  @param  {Function} `format` Custom format function called on each calculated average. Defaults to `n.toFixed(2)`.
  @return {Array} Resulting array of averages.
  @api public