clamp
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/clamp package

1.0.1 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1,178,750
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1,178,750
  • 1.0.0
    22
  • 0.0.0
    2

Package Sidebar

Install

npm i clamp

Weekly Downloads

647,765

Version

1.0.1

License

MIT

Last publish

Collaborators

  • hughsk