Skip to content

GetNumericStats

cartographer


cartographer / getNumericStats

getNumericStats(items, fieldKey): object

Defined in: queries/queryFunctions.ts:313

Calculate count, sum, average, min, and max for a numeric field.

CatalogItem[]

Array of items to analyze

string

Numeric field key to analyze

object

  • Object with count, sum, avg, min, max statistics

count: number

sum: number

avg: number

min: number

max: number

const stats = getNumericStats(items, 'word-count');
console.log(`Average: ${stats.avg}, Range: ${stats.min}-${stats.max}`);