# clamp

> Clamp a value between two other values

Latest version **1.0.1** (published 2014-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install clamp
pnpm add clamp
yarn add clamp
bun add clamp
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2014-07-29 |
| First published | 2013-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/clamp) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Hugh Kennedy |
| Maintainers | hughsk |
| Keywords | clamp, math, greater, less, than, between |

## Links

- npm: https://www.npmjs.com/package/clamp
- Repository: https://github.com/hughsk/clamp
- Issues: https://github.com/hughsk/clamp/issues
- npm.io page: https://npm.io/package/clamp

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2014-07-29
- 1.0.0 — 2014-03-21
- 0.0.0 — 2013-10-16

## README

# clamp [![frozen](http://hughsk.github.io/stability-badges/dist/frozen.svg)](http://github.com/hughsk/stability-badges) #

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](https://nodei.co/npm/clamp.png?mini=true)](https://nodei.co/npm/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](http://github.com/hughsk/clamp/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/clamp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
