quesk
v2.0.1
Published
Queue + Stack ADTs.
Downloads
66
Maintainers
Readme
Quesk
Install
yarn add quesk --dev
npm install quesk --save-dev
UMD file is also available on unpkg:
<script src="https://unpkg.com/quesk/dist/quesk.min.js"></script>
You can use the library via window.quesk
.
Usage
Quesk can act like a Queue or Stack collection.
Queue
import quesk from 'quesk'
const queue = quesk()
console.log(queue.first())
// => undefined
queue.append('a')
queue.append('b')
queue.append('c')
console.log(queue.length())
// => 3
console.log(queue.first())
// => a
queue.shift()
console.log(queue.length())
// => 2
Stack
import quesk from 'quesk'
const stack = quesk()
console.log(stack.last())
// => undefined
stack.prepend('a')
stack.prepend('b')
stack.prepend('c')
console.log(stack.length())
// => 3
console.log(stack.last())
// => c
stack.pop()
console.log(stack.length())
// => 2
API
For more functions check out the source file.
Contributions
Pull requests and issues are very appreciated.
License
MIT license
© 2017 José Luis Quintana