MCPcopy Create free account
hub / github.com/TanStack/db / valueExtractorForMinMax

Function valueExtractorForMinMax

packages/db/src/query/compiler/group-by.ts:532–547  ·  view source on GitHub ↗
([, namespacedRow]: [
    string,
    NamespacedRow,
  ])

Source from the content-addressed store, hash-verified

530
531 // Create a value extractor function for min/max that preserves comparable types
532 const valueExtractorForMinMax = ([, namespacedRow]: [
533 string,
534 NamespacedRow,
535 ]) => {
536 const value = compiledExpr(namespacedRow)
537 // Preserve strings, numbers, Dates, and bigints for comparison
538 if (
539 typeof value === `number` ||
540 typeof value === `string` ||
541 typeof value === `bigint` ||
542 value instanceof Date
543 ) {
544 return value
545 }
546 return value != null ? Number(value) : 0
547 }
548
549 // Create a raw value extractor function for the expression to aggregate
550 const rawValueExtractor = ([, namespacedRow]: [string, NamespacedRow]) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected