MCPcopy Create free account
hub / github.com/angular/components / clamp

Function clamp

src/cdk/drag-drop/drag-utils.ts:77–79  ·  view source on GitHub ↗

Clamps a number between zero and a maximum.

(value: number, max: number)

Source from the content-addressed store, hash-verified

75
76/** Clamps a number between zero and a maximum. */
77function clamp(value: number, max: number): number {
78 return Math.max(0, Math.min(max, value));
79}

Callers 3

moveItemInArrayFunction · 0.70
transferArrayItemFunction · 0.70
copyArrayItemFunction · 0.70

Calls 2

maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected