UNPKG

@prishelets/utils

Version:

A modern utility library for strings, numbers, and general data types — fully typed, tested, and built for Node.js and TypeScript.

16 lines (15 loc) 424 B
"use strict"; // src/number/clamp.ts Object.defineProperty(exports, "__esModule", { value: true }); exports.clamp = clamp; /** * Clamps a number between a minimum and maximum value. * * @param value - The number to clamp. * @param min - Minimum value. * @param max - Maximum value. * @returns A number within the specified range. */ function clamp(value, min, max) { return Math.min(Math.max(value, min), max); }