1.3.4 • Published 3 years ago

react-fifo v1.3.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

What is this ?

Queue data structure as npm package
This package helps you to simulate the behaviour of a queue.
If you are familiar with c++ queues this has exactly same methods.

Installation

npm i react-fifo

Methods

Push

Use - For inserting/pushing data to queue if you want to push say 1,2,3

        queue.push(1)
        queue.push(2)
        queue.push(3)

Pop

Use - For removing data from queue

        queue.pop()
This is follow the property of queue and pop the front element
If there are no element it returns -1 and if popped will return 1

Size

Use - To get the current size of the queue

        queue.size()

Empty

Use - To check if the queue is empty or not

        queue.isEmpty()

Front

Use - To get the front element of the queue

        queue.front()
This returns "empty" if queue is empty else returns the element

Example

Showing adding 4 elements, printing and removing all

const queue = require('react-fifo');

queue.push(1);
queue.push(2);
queue.push(3);
queue.push(4);

while(!queue.isEmpty()){
    console.log(queue.front());
    queue.pop();
}
1.2.0

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago