Simple FIFO queue implementation.
$ npm install --save @fabiospampinato/fifo
import FIFO from '@fabiospampinato/fifo';
const queue = new FIFO ();
queue.add ( 'foo' ).add ( 'bar' ).add ( 'baz' );
queue.next (); // foo
queue.next (); // bar
queue.next (); // baz
queue.next (); // undefined
Returns an instance of FIFO. If queue
is passed the queue will be setted to that.
Returns the queue.
Returns the next element in the queue.
Sets the queue to queue
.
Empties the queue.
Adds an element to the queue.
MIT © Fabio Spampinato