An Easy DSL to manage a stack that puts the first node in the back for next time.
CoffeeScript JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
src
test
.gitignore
Cakefile
LICENSE
package.json
readme.md

readme.md

Stop-N-Go

Your favorite array stack that retreived the first item in the array and then removes it and add it into the back of the array. This module will create a continuous stack of items in array that always keeps the first one in the array as the one that is least used.

Install

npm install stop-n-go

Usage

var list = require('stop-n-go');

list.add('foo');
list.add('foo2');
list.add('foo3');

list.all();
#> ['foo', 'foo2', 'foo3']
list.get();
#> 'foo'
list.all();
#> ['foo2', 'foo3', 'foo']
list.remove('foo3');
#> ['foo2','foo']
list.get();
#> 'foo2'
list.all();
#> ['foo','foo2']

License

See LICENSE

Contributions

pull requests welcome