Socket
Socket
Sign inDemoInstall

@euclid/clamp

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @euclid/clamp

Constrain a value to lie between two further values


Version published
Weekly downloads
2
Maintainers
1
Install size
1.79 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 19 Dec 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc