New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/js-priority-queue

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/js-priority-queue

TypeScript definitions for js-priority-queue

  • 0.0.9
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
decreased by-61%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install --save @types/js-priority-queue

Summary

This package contains type definitions for js-priority-queue (https://github.com/adamhooper/js-priority-queue).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-priority-queue.

index.d.ts

/* =================== USAGE ===================
    import * as PriorityQueue from "js-priority-queue";
    var queue = new PriorityQueue<number>({ comparator: (a, b) => b - a });
    queue.queue(5);
 =============================================== */

declare module "js-priority-queue" {
    class AbstractPriorityQueue<T> {
        /**
         * Returns the number of elements in the queue
         */
        public length: number;
        /**
         * Creates a priority queue
         */
        constructor(options?: PriorityQueue.PriorityQueueOptions<T>);
        /**
         * Inserts a new value in the queue
         */
        public queue(value: T): void;
        /**
         * Returns the smallest item in the queue and leaves the queue unchanged
         */
        public peek(): T;
        /**
         * Returns the smallest item in the queue and removes it from the queue
         */
        public dequeue(): T;
        /**
         * Removes all values from the queue
         */
        public clear(): void;
    }
    namespace PriorityQueue {
        type PriorityQueueOptions<T> = {
            /**
             * This is the argument we would pass to Array.prototype.sort
             */
            comparator?: ((a: T, b: T) => number) | undefined;
            /**
             * You can also pass initial values, in any order.
             * With lots of values, it's faster to load them all at once than one at a time.
             */
            initialValues?: T[] | undefined;
            /**
             * According to JsPerf, the fastest strategy for most cases is BinaryHeapStrategy.
             * Only use ArrayStrategy only if you're queuing items in a very particular order.
             * Don't use BHeapStrategy, except as a lesson in how sometimes miracles in one programming language aren't great in other languages.
             */
            strategy?: typeof AbstractPriorityQueue | undefined;
        };
        class ArrayStrategy<T> extends AbstractPriorityQueue<T> {}
        class BinaryHeapStrategy<T> extends AbstractPriorityQueue<T> {}
        class BHeapStrategy<T> extends AbstractPriorityQueue<T> {}
    }
    class PriorityQueue<T> extends AbstractPriorityQueue<T> {}
    export = PriorityQueue;
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by York Yao.

FAQs

Package last updated on 07 Nov 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