Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core/metrics/utils

Index

Functions

  • A metric factory function.

    throws
    • In case type is not listed in the Context.supportedMetrics;
    • In case v is not in the correct representation for the wanted metric type.

    Parameters

    • type: string

      The type of the metric to create.

    • v: unknown

      The value with which to instantiate the metric.

    Returns Metric<JSONValue, JSONValue>

    A metric instance.

  • validateMetricInternalRepresentation<T>(type: string, v: unknown): v is T
  • Validates that a given value is in the correct internal representation format for a metric of a given type.

    Type parameters

    Parameters

    • type: string

      The type of the metric to validate

    • v: unknown

      The value to verify

    Returns v is T

    Whether or not v is of the correct type.

  • Validates that a given value is a positive integer.

    Parameters

    • v: unknown

      The value to validate

    • zeroIsValid: boolean = true

      Whether or not to consider 0 a valid value, defaults to true

    Returns MetricValidationResult

    A validation result

Generated using TypeDoc