@compactjs/limit
v1.1.0
Published
Limits a value to a defined range
Downloads
6
Readme
Table of Contents
What it does
@compactjs/limit limits any number to a given range. If it exceeds the range, it start back at 0 and equally starts from maximum value if it falls below 0.
Use it to easily calculate hours, minutes or degrees.
Install
NPM:
npm install @compactjs/limit
CDN:
<script src="https://unpkg.com/@compactjs/limit/dist/index.umd.js"></script>
Usage
As module:
import { limit } from '@compactjs/limit';
Example:
// hours
limit(25, 24); // returns: 1
// degrees
limit(90 - 180, 360); // returns: 270
Run tests
npm run test
Contact
👤 Timo Bechtel [email protected]
- Website: https://timobechtel.com
- Twitter: @TimoBechtel
- GitHub: @TimoBechtel
🤝 Contributing
Contributions, issues and feature requests are welcome!
- Check issues
- Fork the Project
- Create your Feature Branch (
git checkout -b feat/AmazingFeature
) - Test your changes
npm run test
- Commit your Changes (
git commit -m 'feat: add amazingFeature'
) - Push to the Branch (
git push origin feat/AmazingFeature
) - Open a Pull Request
Commit messages
This project uses semantic-release for automated release versions. So commits in this project follow the Conventional Commits guidelines. I recommend using commitizen for automated commit messages.
Show your support
Give a ⭐️ if this project helped you!
📝 License
Distributed under the MIT License.
This README was generated with ❤️ by readme-md-generator