MCPcopy
hub / github.com/npmx-dev/npmx.dev / clamp

Function clamp

app/utils/charts.ts:40–44  ·  view source on GitHub ↗
(value: number, minValue: number, maxValue: number)

Source from the content-addressed store, hash-verified

38// Statistics & Interpretation utilities
39
40export function clamp(value: number, minValue: number, maxValue: number): number {
41 if (value < minValue) return minValue
42 if (value > maxValue) return maxValue
43 return value
44}
45
46/**
47 * Computes a quantile value from a sorted numeric array using linear interpolation.

Callers 2

charts.spec.tsFile · 0.90
winsorizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected