Skip to main content

@repo/utils

Shared utility functions for the monorepo.

Math

  • average(values: number[]): number | null — arithmetic mean, null for empty arrays
  • median(values: number[]): number | null — median value, null for empty arrays
  • nullMap<T, U>(value: T | null | undefined, fn: (v: T) => U): U | null — apply fn if value is non-null, otherwise return null