Skip to main content

Benji's personal standard library. Collection of tools for manipulating strings, async iterables, shell scripting, and common data structures.

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
76%
Published
5 months ago (1.5.1)
class Queue.Queue
implements Iterable<T>

Data structure allowing for the insertion and removal of elements in a FIFO manner in O(1) time.

Constructors

new
Queue(initials?: Iterable<T>)

Type Parameters

Properties

readonly
length: number

The number of elements remaining in the queue

Methods

[Symbol.iterator](): Generator<NonNullable<T>, void, unknown>
peek(): T | undefined

Preview the next element in the queue without removing it.

pop(): T | undefined

Remove an element from the queue and return it.

push(element: T): void

Add an element to the queue

Add Package

deno add jsr:@mindfulminun/pear

Import symbol

import { Queue } from "@mindfulminun/pear/tools/structures";

---- OR ----

Import directly with a jsr specifier

import { Queue } from "jsr:@mindfulminun/pear/tools/structures";

Add Package

npx jsr add @mindfulminun/pear

Import symbol

import { Queue } from "@mindfulminun/pear/tools/structures";

Add Package

yarn dlx jsr add @mindfulminun/pear

Import symbol

import { Queue } from "@mindfulminun/pear/tools/structures";

Add Package

pnpm dlx jsr add @mindfulminun/pear

Import symbol

import { Queue } from "@mindfulminun/pear/tools/structures";

Add Package

bunx jsr add @mindfulminun/pear

Import symbol

import { Queue } from "@mindfulminun/pear/tools/structures";