1. clamp
Clamp a value between two other values
clamp
Package: clamp
Created by: hughsk
Last modified: Mon, 13 Jun 2022 06:05:01 GMT
Version: 1.0.1
License: MIT
Downloads: 2,090,747
Repository: https://github.com/hughsk/clamp

Install

npm install clamp
yarn add clamp

clamp frozen

Clamp a value between two other values. It's as simple as modules come - saving
keystrokes because I've had to write this function too many times.

Usage

clamp

clamp(value, a, b)

Returns value, if it is between a and b. Otherwise, returns the number
it's gone past.

License

MIT. See LICENSE.md for details.

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code