Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

440 B
Raw Blame
export class Queue<T> {
    elements: T[];
  
    constructor() {
      this.elements = [];
    }
  
    enqueue(data: T) {
      this.elements.push(data);
    }
  
    dequeue() {
      return this.elements.shift();
    }
  
    isEmpty() {
      return this.elements.length === 0;
    }
  
    peek() {
      return !this.isEmpty() ? this.elements[0] : undefined;
    }
  
    length = () => {
      return this.elements.length;
    }
  }