# math-clamp-x

> Clamp a number to limits.

Latest version **3.2.2** (published 2019-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install math-clamp-x
pnpm add math-clamp-x
yarn add math-clamp-x
bun add math-clamp-x
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.2 |
| Published | 2019-08-28 |
| First published | 2017-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8.11.4 |
| Dependencies | 1 |
| Unpacked size | 225.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Graham Fairweather |
| Maintainers | xotic750 |
| Keywords | math, clamp, module, javascript, nodejs, browser |

## Links

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

## Dependencies (1)

- [to-number-x](https://npm.io/package/to-number-x.md) ^3.2.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.2.2 (latest) — 2019-08-28
- 3.2.1 — 2019-08-20
- 3.2.0 — 2019-08-14
- 3.1.0 — 2019-08-14
- 3.0.23 — 2019-07-31
- 3.0.22 — 2019-07-27
- 3.0.21 — 2019-07-27
- 3.0.20 — 2019-07-27
- 3.0.19 — 2019-07-26
- 3.0.18 — 2019-07-25
- 3.0.17 — 2019-07-24
- 3.0.16 — 2019-07-24
- 3.0.15 — 2019-07-24
- 3.0.14 — 2019-07-22
- 3.0.13 — 2019-07-21
- … 16 more at https://npm.io/package/math-clamp-x/versions

## README

<a
  href="https://travis-ci.org/Xotic750/math-clamp-x"
  title="Travis status">
<img
  src="https://travis-ci.org/Xotic750/math-clamp-x.svg?branch=master"
  alt="Travis status" height="18">
</a>
<a
  href="https://david-dm.org/Xotic750/math-clamp-x"
  title="Dependency status">
<img src="https://david-dm.org/Xotic750/math-clamp-x/status.svg"
  alt="Dependency status" height="18"/>
</a>
<a
  href="https://david-dm.org/Xotic750/math-clamp-x?type=dev"
  title="devDependency status">
<img src="https://david-dm.org/Xotic750/math-clamp-x/dev-status.svg"
  alt="devDependency status" height="18"/>
</a>
<a
  href="https://badge.fury.io/js/math-clamp-x"
  title="npm version">
<img src="https://badge.fury.io/js/math-clamp-x.svg"
  alt="npm version" height="18">
</a>
<a
  href="https://www.jsdelivr.com/package/npm/math-clamp-x"
  title="jsDelivr hits">
<img src="https://data.jsdelivr.com/v1/package/npm/math-clamp-x/badge?style=rounded"
  alt="jsDelivr hits" height="18">
</a>
<a
  href="https://bettercodehub.com/results/Xotic750/math-clamp-x"
  title="bettercodehub score">
<img src="https://bettercodehub.com/edge/badge/Xotic750/math-clamp-x?branch=master"
  alt="bettercodehub score" height="18">
</a>
<a
  href="https://coveralls.io/github/Xotic750/math-clamp-x?branch=master"
  title="Coverage Status">
<img src="https://coveralls.io/repos/github/Xotic750/math-clamp-x/badge.svg?branch=master"
  alt="Coverage Status" height="18">
</a>

<a name="module_math-clamp-x"></a>

## math-clamp-x

Clamp a number to limits.

<a name="exp_module_math-clamp-x--module.exports"></a>

### `module.exports(value, [min], max)` ⇒ <code>number</code> ⏏

This method clamp a number to min and max limits inclusive.

**Kind**: Exported function  
**Returns**: <code>number</code> - The clamped number.  
**Throws**:

- <code>RangeError</code> If min > max.

| Param | Type                | Default        | Description               |
| ----- | ------------------- | -------------- | ------------------------- |
| value | <code>number</code> |                | The number to be clamped. |
| [min] | <code>number</code> | <code>0</code> | The minimum number.       |
| max   | <code>number</code> |                | The maximum number.       |

**Example**

```js
import mathClamp from 'math-clamp-x';

console.log(mathClamp(-5, 3, 3)); // 3
console.log(mathClamp(0, 3, 3)); // 3
console.log(mathClamp(5, 3, 3)); // 3
```

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