@ocyrusjs/clamp
v1.0.0
Published
High-performance number clamping.
Readme
@ocyrusjs/clamp 🌑
High-performance number clamping.
Part of the Ocyrus suite.
✨ Features
- Blazing Fast: 1.3x faster than native
Math.min(Math.max()). - Zero-Allocation: Minimal branching logic.
🚀 Performance
clamp: ~25M ops/sec
📦 Installation
npm install @ocyrusjs/clamp🛠️ Usage
import { clamp } from '@ocyrusjs/clamp';
clamp(10, 0, 5); // 5
clamp(-5, 0, 10); // 0License
MIT © Nishith Patel
