
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@andersaloof/next-step
Advanced tools
Steps an integer by a specified amount (+ or -), within a range from 0 to max, wrapping when the new value exceeds the range.
Steps an integer by a specified amount (+ or -), within a range from 0 to max, wrapping when the new value exceeds the range.
$ npm install @andersaloof/next-step
Having made similar logic in a dozen of slideshows/galleries over the years, handling previous and next buttons to increase/decrease a current index, it was time to move it out to a separate module.
nextStep(current, max, value)
const nextStep = require('@andersaloof/next-step');
const nextValue = nextStep(1, 5, 2); // Increase current value 1 by 2, returns 3;
const anotherValue = nextStep(1, 5, -3); // Decrease current value 1 by -3, with a max value of 5, returns 4;
MIT. See LICENSE.md for details.
FAQs
Steps an integer by a specified amount (+ or -), within a range from 0 to max, wrapping when the new value exceeds the range.
We found that @andersaloof/next-step demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.