https://github.com/electerious/limit-number
Limit a number between a min and max value.
https://github.com/electerious/limit-number
limit max min number
Last synced: 4 months ago
JSON representation
Limit a number between a min and max value.
- Host: GitHub
- URL: https://github.com/electerious/limit-number
- Owner: electerious
- License: mit
- Created: 2016-12-09T21:27:03.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-01T13:59:13.000Z (about 3 years ago)
- Last Synced: 2025-05-15T13:43:57.418Z (5 months ago)
- Topics: limit, max, min, number
- Language: JavaScript
- Size: 28.3 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# limit-number
 [](https://coveralls.io/github/electerious/limit-number?branch=master)
Limit a number between a min and max value.
## Install
```
npm install limit-number
```## Usage
```js
const limit = require('limit-number')limit(0, 10, 5) // 5
limit(0, 10, 15) // 10
limit(0, 10, -5) // 0
```## Parameters
- `min` `{Number}` Min number.
- `max` `{Number}` Max number.
- `num` `{Number}` Number.## Returns
- `{Number}` Limited number.