
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@types/js-priority-queue
Advanced tools
TypeScript definitions for js-priority-queue
npm install --save @types/js-priority-queue
This package contains type definitions for js-priority-queue (https://github.com/adamhooper/js-priority-queue).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-priority-queue.
/* =================== 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;
}
These definitions were written by York Yao.
FAQs
TypeScript definitions for js-priority-queue
The npm package @types/js-priority-queue receives a total of 1,442 weekly downloads. As such, @types/js-priority-queue popularity was classified as popular.
We found that @types/js-priority-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.