MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / clamp

Function clamp

src/content/Components/ProfileCard/ProfileCard.jsx:14–14  ·  view source on GitHub ↗
(v, min = 0, max = 100)

Source from the content-addressed store, hash-verified

12};
13
14const clamp = (v, min = 0, max = 100) => Math.min(Math.max(v, min), max);
15const round = (v, precision = 3) => parseFloat(v.toFixed(precision));
16const adjust = (v, fMin, fMax, tMin, tMax) => round(tMin + ((tMax - tMin) * (v - fMin)) / (fMax - fMin));
17

Callers 2

setVarsFromXYFunction · 0.70
ProfileCardComponentFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected