rotary-arraydeprecated

A simple helper to rotate an ordered collection of data

Usage no npm install needed!

<script type="module">
  import rotaryArray from 'https://cdn.skypack.dev/rotary-array';
</script>

README

Rotary

build status js-standard-style

Rotary is a simple helper to rotate an ordered collection of data. I use this technique most often with sliders and don't want to rewrite this every single time.

Installation

$ npm install rotary-array
$ npm install marcusandre/rotary

Usage

var Rotary = require('rotary')
var r = Rotary([1, 2, 3])
r.next() // 2, 3, 1
r.previous() // 1, 2, 3

Todo

  • fn.get(num) to rotate until num is first item

Test & Coverage

$ make test
$ make coverage

License

MIT