docs: 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;
  }