UNPKG

@shoelace-style/shoelace

Version:

A forward-thinking library of web components.

16 lines (14 loc) 285 B
// src/internal/math.ts function clamp(value, min, max) { const noNegativeZero = (n) => Object.is(n, -0) ? 0 : n; if (value < min) { return noNegativeZero(min); } if (value > max) { return noNegativeZero(max); } return noNegativeZero(value); } export { clamp };