# @andersaloof/next-step

> Steps an integer by a specified amount (+ or -), within a range from 0 to max, wrapping when the new value exceeds the range.

Latest version **1.0.0** (published 2018-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @andersaloof/next-step
pnpm add @andersaloof/next-step
yarn add @andersaloof/next-step
bun add @andersaloof/next-step
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-08-17 |
| First published | 2018-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Anders S. Øfsdahl |
| Maintainers | andersaloof |
| Keywords | next, step, prev |

## Links

- npm: https://www.npmjs.com/package/@andersaloof/next-step
- Repository: https://github.com/andersaloof/next-step
- Homepage: https://github.com/andersaloof/next-step#readme
- Issues: https://github.com/andersaloof/next-step/issues
- npm.io page: https://npm.io/package/@andersaloof/next-step

## Recent versions

- 1.0.0 (latest) — 2018-08-17

## README

# nextStep [![Build Status](https://travis-ci.org/andersaloof/next-step.svg?branch=master)](https://travis-ci.org/andersaloof/next-step)

Steps an integer by a specified amount (+ or -), within a range from 0 to max, wrapping when the new value exceeds the range.

## Install

```
$ npm install @andersaloof/next-step
```

## Why?

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.

## Usage

**`nextStep(current, max, value)`**


### Example code

```js
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;
```

## License

MIT. See LICENSE.md for details.

---
_Source: https://npm.io/package/@andersaloof/next-step · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
