Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@euclid/clamp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@euclid/clamp

Constrain a value to lie between two further values

latest
npmnpm
Version
1.0.0-alpha.0
Version published
Maintainers
1
Created
Source

@euclid/clamp

Constrain a value to lie between two further values

$ npm install @euclid/clamp

Example

let v = clamp(11, 0, 10);
//=> 10

API

Clamps the number n between min (inclusive) and max (inclusive).

clamp(n, min, max)

Returns: Number

Number clamped in range min and max.

n

Type: Number

Value to clamp.

min

Type: Number

Lower end of the range into which to constrain n.

max

Type: Number

Upper end of the range into which to constrain n.

Keywords

math

FAQs

Package last updated on 19 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts