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.

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i clamp

    Weekly Downloads

    567,401

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • hughsk