UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

18 lines 529 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = clamp; /** * Clamps a number between a minimum and maximum value. * @param value - The number to clamp. * @param min - The minimum allowed value. * @param max - The maximum allowed value. * @returns The clamped value. * @example * clamp(15, 0, 10); // 10 * clamp(-5, 0, 10); // 0 * clamp(5, 0, 10); // 5 */ function clamp(value, min, max) { return Math.max(min, Math.min(max, value)); } //# sourceMappingURL=clamp.js.map