@llblab/uniqueue 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,10 +24,10 @@ npm install @llblab/uniqueue
24
24
  ### Basic Example (Max Heap)
25
25
 
26
26
  ```javascript
27
- import { UniQueue } from "@llblab/uniqueue";
27
+ import { Uniqueue } from "@llblab/uniqueue";
28
28
 
29
29
  // Create a max-heap for leaderboard scores
30
- const leaderboard = new UniQueue({
30
+ const leaderboard = new Uniqueue({
31
31
  compare: (a, b) => b.score - a.score, // Sort by score descending
32
32
  extractKey: (item) => item.playerId, // Unique by playerId
33
33
  maxSize: 3, // Keep only top 3 scores
@@ -60,7 +60,7 @@ for (const player of leaderboard) {
60
60
 
61
61
  ## API
62
62
 
63
- ### `new UniQueue(options)`
63
+ ### `new Uniqueue(options)`
64
64
 
65
65
  Creates a new priority queue instance.
66
66
 
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export interface UniQueueOptions<T> {
1
+ export interface UniqueueOptions<T> {
2
2
  data?: T[];
3
3
  maxSize?: number;
4
4
  compare?: (a: T, b: T) => number;
5
5
  extractKey?: (item: T) => string;
6
6
  }
7
- export declare class UniQueue<T> {
7
+ export declare class Uniqueue<T> {
8
8
  #private;
9
9
  data: T[];
10
10
  indexes: Map<string, number>;
11
- constructor({ data, maxSize, compare, extractKey, }?: UniQueueOptions<T>);
11
+ constructor({ data, maxSize, compare, extractKey, }?: UniqueueOptions<T>);
12
12
  push(item: T): T | undefined;
13
13
  pop(): T | undefined;
14
14
  peek(): T | undefined;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export class UniQueue {
1
+ export class Uniqueue {
2
2
  data;
3
3
  indexes;
4
4
  #maxSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/uniqueue",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "High-performance priority queue with unique key constraint (O(1) lookup, O(log n) update)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",