Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/priorityqueuejs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/priorityqueuejs

TypeScript definitions for priorityqueuejs

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
increased by1.24%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install --save @types/priorityqueuejs

Summary

This package contains type definitions for priorityqueuejs (https://github.com/janogonzalez/priorityqueuejs).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/priorityqueuejs.

index.d.ts

declare class PriorityQueue<T> {
    /**
     * Compares two Number or String objects.
     */
    static DEFAULT_COMPARATOR: PriorityQueue.Comparator<number | string>;

    /**
     * Initializes a new empty PriorityQueue wich uses .DEFAULT_COMPARATOR() as the comparator function for its elements.
     */
    constructor();

    /**
     * Initializes a new empty PriorityQueue with uses the given comparator(a, b) function as the comparator for its elements.
     * The comparator function must return a positive number when a > b, 0 when a == b and a negative number when a < b.
     */
    constructor(comparator: PriorityQueue.Comparator<T>);

    /**
     * Dequeues the top element of the priority queue.
     * Throws an Error when the queue is empty.
     */
    deq(): T;

    /**
     * Enqueues the element at the priority queue and returns its new size.
     * @param element The element to add
     */
    enq(element: T): number;

    /**
     * Executes fn on each element.
     * Just be careful to not modify the priorities, since the queue won't reorder itself.
     * @param fn The value to pass to an Array.forEach call
     */
    forEach(fn: (value: T, index: number, array: T[]) => void): void;

    /**
     * Returns whether the priority queue is empty or not.
     */
    isEmpty(): boolean;

    /**
     * Peeks at the top element of the priority queue.
     * Throws an Error when the queue is empty.
     */
    peek(): T;

    /**
     * Returns the size of the priority queue.
     */
    size(): number;
}

declare namespace PriorityQueue {
    export interface Comparator<T> {
        (a: T, b: T): number;
    }
}

export = PriorityQueue;

Additional Details

  • Last updated: Wed, 18 Oct 2023 05:47:09 GMT
  • Dependencies: none

Credits

These definitions were written by Joshua DeVinney.

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc