@mega-yfue/eufy-sdk / clamp
Function: clamp()
ts
function clamp(
value,
min,
max
): number;Round to an integer and clamp into [min, max]. For scalar device params that take a bounded int (volume/brightness/color-temp 0..100, etc.), dispatched fire-and-forget — a non-numeric or out-of-range input must never reach the wire as-is. NaN input (e.g. Number("x")) fails safe to min: Math.max/Math.min propagate NaN rather than ignoring it, so that has to be checked explicitly, not relied on implicitly.
Parameters
value
number
min
number
max
number
Returns
number