@grinstead/priority-queue
Advanced tools
Comparing version
{ | ||
"name": "@grinstead/priority-queue", | ||
"author": "Joe Grinstead <npm@mailforce.net>", | ||
"private": false, | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
@@ -7,0 +7,0 @@ "types": "dist/index.d.ts", |
@@ -35,3 +35,3 @@ # PriorityQueue | ||
```typescript | ||
const pq = new PriorityQueue<number>(); | ||
const queue = new PriorityQueue<number>(); | ||
``` | ||
@@ -42,3 +42,3 @@ | ||
```typescript | ||
const pq = new PriorityQueue<number>(true); | ||
const queue = new PriorityQueue<number>(true); | ||
``` | ||
@@ -51,4 +51,4 @@ | ||
```typescript | ||
pq.add(1, "low priority item"); | ||
pq.add(10, "high priority item"); | ||
queue.add(1, "low priority item"); | ||
queue.add(10, "high priority item"); | ||
``` | ||
@@ -61,3 +61,3 @@ | ||
```typescript | ||
console.log(pq.peek()); // Outputs: 'high priority item' | ||
console.log(queue.peek()); // Outputs: 'high priority item' | ||
``` | ||
@@ -70,3 +70,3 @@ | ||
```typescript | ||
console.log(pq.peekPriority()); // Outputs: 10 | ||
console.log(queue.peekPriority()); // Outputs: 10 | ||
``` | ||
@@ -79,4 +79,4 @@ | ||
```typescript | ||
console.log(pq.poll()); // Outputs: 'high priority item' | ||
console.log(pq.peek()); // Outputs: 'low priority item' | ||
console.log(queue.poll()); // Outputs: 'high priority item' | ||
console.log(queue.peek()); // Outputs: 'low priority item' | ||
``` | ||
@@ -83,0 +83,0 @@ |
7774
0.31%Yes
NaN