# priority-queues

> priority queue(heap) data structure for node.js and browsers

Latest version **1.0.0** (published 2018-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install priority-queues
pnpm add priority-queues
yarn add priority-queues
bun add priority-queues
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-01-13 |
| First published | 2018-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ashwin Kandel |
| Maintainers | incessantmeraki |
| Keywords | priority-queue, heap, adt |

## Links

- npm: https://www.npmjs.com/package/priority-queues
- Repository: https://github.com/incessantmeraki/priority-queues
- Homepage: https://github.com/incessantmeraki/priority-queues#readme
- Issues: https://github.com/incessantmeraki/priority-queues/issues
- npm.io page: https://npm.io/package/priority-queues

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-01-13

## README

# priority-queues

[![Build Status](https://travis-ci.org/incessantmeraki/priority-queues.svg?branch=master)](https://travis-ci.org/incessantmeraki/priority-queues)

priority queue using heap data structure

## Usage

### Example

```js
  var PQueue = require('priority-queues')
  
  p = new PQueue()
  
  // push elements into the queue
  p.push(4)
  p.push(2)
  p.push(1)

  //pop elements out of the queue
  p.pop() //1
  p.pop() //2
  p.pop() //4
```

### API

#### `p = new PQueue([arr])`
create new instance of priority queue. If arr given then creates the heap using this array otherwise empty queue

#### `p.push(element)`
pushes element into the heap structure

#### `p.pop()`
pops the first element(minimum one) from the heap structure

#### `d.size()`
returns the number of elements in the queue

#### `p.isEmpty()`
returns true if the queue is empty

## License

MIT

---
_Source: https://npm.io/package/priority-queues · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
