quesk

2.0.1 • Public • Published

Quesk

Build Status Coverage Status js-standard-style

Queue + Stack ADTs.

Install

Yarn

yarn add quesk --dev

NPM

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

Package Sidebar

Install

npm i quesk

Weekly Downloads

15

Version

2.0.1

License

MIT

Last publish

Collaborators

  • joseluisq