ixfx
    Preparing search index...

    Function minMaxAvg

    • Returns the min, max, avg and total of the array or iterable. Any values that are invalid are silently skipped over.

      import { Arrays } from 'https://unpkg.com/ixfx/dist/collections.js';

      const v = [10, 2, 4.2, 99];
      const mma = Arrays.minMaxAvg(v);
      Yields: { min: 2, max: 99, total: 115.2, avg: 28.8 }

      Use Numbers.average, Numbers.max, Numbers.min or Numbers.total if you only need one of these.

      A start and end range can be provided if the calculation should be restricted to a part of the input array. By default the whole array is used.

      It's also possible to use an iterable as input.

      Arrays.minMaxAvg(count(5,1)); // Averages 1,2,3,4,5
      

      Parameters

      • data: number[] | readonly number[] | Iterable<number, any, any>
      • opts: MinMaxAvgOpts = {}

        Allows restriction of range that is examined

      Returns MinMaxAvgTotal

      {min, max, avg, total}