MCPcopy Index your code
hub / github.com/adobe/react-spectrum / clamp

Function clamp

packages/react-stately/src/utils/number.ts:17–20  ·  view source on GitHub ↗
(value: number, min: number = -Infinity, max: number = Infinity)

Source from the content-addressed store, hash-verified

15 * valid step.
16 */
17export function clamp(value: number, min: number = -Infinity, max: number = Infinity): number {
18 let newValue = Math.min(Math.max(value, min), max);
19 return newValue;
20}
21
22export function roundToStepPrecision(value: number, step: number): number {
23 let roundedValue = value;

Callers 15

useProgressBarFunction · 0.90
onMoveFunction · 0.90
onMoveFunction · 0.90
computePositionFunction · 0.90
onMoveToFunction · 0.90
number.test.tsFile · 0.90
useNumberFieldStateFunction · 0.90
getPercentValueFunction · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected