|
| 1 | +<h1 align="center">@compactjs/limit</h1> |
| 2 | +<h3 align="center">Limits a value to a defined range</h3> |
| 3 | +<p align="center"> |
| 4 | + <a href="https://www.npmjs.com/package/@compactjs/limit" target="_blank"> |
| 5 | + <img alt="Version" src="https://img.shields.io/npm/v/@compactjs/limit.svg"> |
| 6 | + </a> |
| 7 | + <a href="https://github.com/CompactJS/limit/blob/master/LICENSE" target="_blank"> |
| 8 | + <img alt="License: MIT" src="https://img.shields.io/github/license/CompactJS/limit" /> |
| 9 | + </a> |
| 10 | +</p> |
| 11 | +<p align="center"> |
| 12 | + · |
| 13 | + <a href="https://github.com/CompactJS/limit#readme">Homepage</a> |
| 14 | + · |
| 15 | + <a href="https://github.com/CompactJS/limit/issues">Report Bug / Request Feature</a> |
| 16 | + · |
| 17 | +</p> |
| 18 | + |
| 19 | +<p align="center"> |
| 20 | +</p> |
| 21 | + |
| 22 | +## Table of Contents |
| 23 | + |
| 24 | +- [About](#What-it-does) |
| 25 | +- [Installation](#Install) |
| 26 | +- [Usage](#usage) |
| 27 | +- [Test](#run-tests) |
| 28 | +- [Contact](#contact) |
| 29 | +- [Contributing](#Contributing) |
| 30 | +- [License](#license) |
| 31 | + |
| 32 | +## What it does |
| 33 | + |
| 34 | +@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. |
| 35 | + |
| 36 | +Use it to easily calculate hours, minutes or degrees. |
| 37 | + |
| 38 | +## Install |
| 39 | + |
| 40 | +### NPM: |
| 41 | + |
| 42 | +```sh |
| 43 | +npm install @compactjs/limit |
| 44 | +``` |
| 45 | + |
| 46 | +### CDN: |
| 47 | + |
| 48 | +```html |
| 49 | +<script src="https://unpkg.com/@compactjs/limit/dist/index.umd.js"></script> |
| 50 | +``` |
| 51 | + |
| 52 | + |
| 53 | +## Usage |
| 54 | + |
| 55 | +### As module: |
| 56 | + |
| 57 | +```javascript |
| 58 | +import { limit } from '@compactjs/limit'; |
| 59 | +``` |
| 60 | + |
| 61 | +### Example: |
| 62 | + |
| 63 | +```javascript |
| 64 | +// hours |
| 65 | +limit(25, 24); // returns: 1 |
| 66 | + |
| 67 | +// degrees |
| 68 | +limit(90 - 180, 360); // returns: 270 |
| 69 | +``` |
| 70 | + |
| 71 | + |
| 72 | +## Run tests |
| 73 | + |
| 74 | +```sh |
| 75 | +npm run test |
| 76 | +``` |
| 77 | + |
| 78 | + |
| 79 | +## Contact |
| 80 | + |
| 81 | + |
| 82 | +👤 **Timo Bechtel <timo@bechtel.solutions>** |
| 83 | + |
| 84 | +- Website: https://timobechtel.com |
| 85 | +- Twitter: [@TimoBechtel](https://twitter.com/TimoBechtel) |
| 86 | +- GitHub: [@TimoBechtel](https://github.com/TimoBechtel) |
| 87 | + |
| 88 | +## 🤝 Contributing |
| 89 | + |
| 90 | +Contributions, issues and feature requests are welcome!<br /> |
| 91 | + |
| 92 | +1. Check [issues](https://github.com/CompactJS/limit/issues) |
| 93 | +1. Fork the Project |
| 94 | +1. Create your Feature Branch (`git checkout -b feat/AmazingFeature`) |
| 95 | +1. Test your changes `npm run test` |
| 96 | +1. Commit your Changes (`git commit -m 'feat: add amazingFeature'`) |
| 97 | +1. Push to the Branch (`git push origin feat/AmazingFeature`) |
| 98 | +1. Open a Pull Request |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +### Commit messages |
| 103 | + |
| 104 | +This project uses semantic-release for automated release versions. So commits in this project follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) guidelines. I recommend using [commitizen](https://github.com/commitizen/cz-cli) for automated commit messages. |
| 105 | + |
| 106 | +## Show your support |
| 107 | + |
| 108 | +Give a ⭐️ if this project helped you! |
| 109 | + |
| 110 | +## 📝 License |
| 111 | + |
| 112 | +Distributed under the [MIT](https://github.com/CompactJS/limit/blob/master/LICENSE) License. |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ |
0 commit comments