Giter VIP home page Giter VIP logo

queue_stack.js's Introduction

Build Status

queue_stack.js

Some Queue and Stack utility for both server-side and client-side javascript.

Usage

Queue

var myQueue = queue_stack.createQueue();
myQueue.size();         // 0
myQueue.isEmpty();      // true
myQueue.dequeue();      // undefined

myQueue.enqueue("1st").enqueue("2nd").enqueue("3rd");
myQueue.size();         // 3
myQueue.getArrayCopy(); // ["1st","2nd","3rd"] Non-destructive
myQueue.toString(",");  // "1st,2nd,3rd" Non-destructive
myQueue.dequeue();      // "1st"
myQueue.peek();         // "2nd" Non-destructive
myQueue.dequeue();      // "2nd"

myQueue.clear();
myQueue.size();         // 0
myQueue.isEmpty();      // true
myQueue.dequeue();      // undefined

Stack

var myStack = queue_stack.createStack();
myStack.size();         // 0
myStack.isEmpty();      // true
myStack.dequeue();      // undefined

myStack.push("1st").push("2nd").push("3rd");
myStack.size();         // 3
myStack.getArrayCopy(); // ["1st","2nd","3rd"] Non-destructive
myStack.toString(" ");  // "1st 2nd 3rd" Non-destructive
myStack.pop();          // "3rd"
myStack.peek();         // "2nd" Non-destructive
myStack.pop();          // "2nd"

myStack.clear();
myStack.size();         // 0
myStack.isEmpty();      // true
myStack.pop();          // undefined

License

Licensed under the incredibly permissive MIT License
Copyright © 2012 Takeharu.Oshida

queue_stack.js's People

Contributors

georgeosddev avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.