TinyBase logoTinyBase

MetricAggregate

The MetricAggregate type describes a custom function that takes an array of numbers and returns an aggregate that is used as a Metric.

(
  numbers: number[],
  length: number,
): Metric
TypeDescription
numbersnumber[]

The array of numbers in the Metric's aggregation.

lengthnumber

The length of the array of numbers in the Metric's aggregation.

returnsMetric

The value of the Metric.

There are a number of common predefined aggregators, such as for counting, summing, and averaging values. This type is instead used for when you wish to use a more complex aggregation of your own devising. See the setMetricDefinition method for more examples.

Since

v1.0.0