# array-next

> Advance to the next item in the array looping when hitting the end.

Latest version **0.0.1** (published 2013-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-next
pnpm add array-next
yarn add array-next
bun add array-next
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2013-11-11 |
| First published | 2013-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Henrik Joreteg |
| Maintainers | henrikjoreteg |
| Keywords | util, array, index |

## Links

- npm: https://www.npmjs.com/package/array-next
- Repository: https://github.com/HenrikJoreteg/array-next
- Issues: https://github.com/HenrikJoreteg/array-next/issues
- npm.io page: https://npm.io/package/array-next

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2013-11-11

## README

# array-next

Super tiny module that returns the `next` item in an array when given an item in the array.

If you give it the last item in the array and call `next` it will loop around and give you the first.


## installing

```
npm install array-next
```

## how to use

```js
var next = require('array-next');

// our demo array
var arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];

// if none specified next should return first
next(arr); // returns 'a'

// when given an item in the array it returns the next one
next(arr, 'a'); // returns 'b'

// it also loops if you give it the last item
next(arr, 'c'); // returns 'a'
```


## credits

If you like this, follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter.

Check out similar resources at: http://resources.humanjavascript.com.

And check out my book: http://humanjavascript.com


## unit tests? 

run them with `npm test`

read them here: [test.js](test.js)

## license

MIT

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