Hey everyone! I’ve just published a new npm package on my personal website, #WebDevWizard: @hridel/modulo.
I created this package to tackle some challenges I encountered with modular arithmetic in JavaScript. If you ever need to handle both positive and negative numbers and consistently get non-negative results, this package is made for you!
I created this package to tackle some challenges I encountered with modular arithmetic in JavaScript. If you ever need to handle both positive and negative numbers and consistently get non-negative results, this package is made for you!
What Can @hridel/modulo Do?
@hridel/modulo is a robust utility for modular arithmetic in JavaScript, featuring:
• Support for positive and negative integers – no more issues with negative values when working with cyclic or circular data structures.
• Consistent, non-negative results – perfect for scenarios where you need to handle indexes, such as in circular buffer implementations.
• Simple usage for mathematical computations – from basic modulo operations to more complex cases.
How to Use This Package
You can find examples and more details here. The package should be intuitive for anyone looking for added flexibility and reliability with modular arithmetic in JavaScript.
I’m excited to contribute this small but practical tool to the JavaScript ecosystem, and I look forward to your feedback!