diff --git a/src/LinkedQueue.spec.ts b/src/Buffer.spec.ts
similarity index 77%
rename from src/LinkedQueue.spec.ts
rename to src/Buffer.spec.ts
index d60c9457..736a617f 100644
--- a/src/LinkedQueue.spec.ts
+++ b/src/Buffer.spec.ts
@@ -1,13 +1,13 @@
-import LinkedQueue from './LinkedQueue';
+import Buffer from './Buffer';
-describe('LinkedQueue', () => {
+describe('Buffer', () => {
it('constructs', () => {
- const q = new LinkedQueue();
- expect(q).toBeInstanceOf(LinkedQueue);
+ const q = new Buffer();
+ expect(q).toBeInstanceOf(Buffer);
});
it('circulates with a limit of one', () => {
- const q = new LinkedQueue(1);
+ const q = new Buffer(1);
q.enqueue(1);
q.enqueue(2);
q.enqueue(3);
@@ -18,7 +18,7 @@ describe('LinkedQueue', () => {
});
it('circulates with a limit of two', () => {
- const q = new LinkedQueue(2);
+ const q = new Buffer(2);
q.enqueue(1);
q.enqueue(2);
q.enqueue(3);
@@ -32,12 +32,12 @@ describe('LinkedQueue', () => {
});
it('empty throws', () => {
- const q = new LinkedQueue();
+ const q = new Buffer();
expect(() => q.dequeue()).toThrow();
});
it(`doesn't circulate without a limit`, () => {
- const q = new LinkedQueue();
+ const q = new Buffer();
q.enqueue(1);
q.enqueue(2);
q.enqueue(3);
@@ -48,7 +48,7 @@ describe('LinkedQueue', () => {
});
it(`clears`, () => {
- const q = new LinkedQueue();
+ const q = new Buffer();
q.enqueue(1);
q.enqueue(2);
q.clear();
@@ -57,7 +57,7 @@ describe('LinkedQueue', () => {
});
it(`foreaches`, () => {
- const q = new LinkedQueue();
+ const q = new Buffer();
q.enqueue(1);
q.enqueue(2);
let n = 0;
@@ -66,7 +66,7 @@ describe('LinkedQueue', () => {
});
it('iterates', () => {
- const q = new LinkedQueue();
+ const q = new Buffer();
q.enqueue(1);
q.enqueue(2);
expect([...q]).toEqual([1, 2]);
diff --git a/src/LinkedQueue.ts b/src/Buffer.ts
similarity index 93%
rename from src/LinkedQueue.ts
rename to src/Buffer.ts
index 558057aa..d2867931 100644
--- a/src/LinkedQueue.ts
+++ b/src/Buffer.ts
@@ -2,9 +2,9 @@ import fastList from 'fast-list';
/**
* First-in, first-out (FIFO) buffer (queue) with default item values.
- * Optionally circular based on {@link LinkedQueue.limit}.
+ * Optionally circular based on {@link Buffer.limit}.
*/
-export default class LinkedQueue {
+export default class Buffer {
#list: fastList.List;
length = 0;
diff --git a/src/adapters/Channel.ts b/src/adapters/Channel.ts
index 92edb742..455e74a3 100644
--- a/src/adapters/Channel.ts
+++ b/src/adapters/Channel.ts
@@ -1,5 +1,5 @@
import Deferred from '../Deferred';
-import LinkedQueue from '../LinkedQueue';
+import Buffer from '../Buffer';
import { PushAdapter, doneResult } from '../common';
import fromDom from '../fromDom';
import fromEmitter from '../fromEmitter';
@@ -26,9 +26,9 @@ export interface Unpushed {
*/
export default class Channel implements PushAdapter {
/** Pushed results waiting for pulls to resolve */
- readonly pushBuffer: LinkedQueue>;
+ readonly pushBuffer: Buffer>;
/** Unresolved pulls waiting for results to be pushed */
- readonly pullBuffer: LinkedQueue>>;
+ readonly pullBuffer: Buffer>>;
/** Determines whether new values can be pushed or pulled */
private closed = false;
@@ -39,8 +39,8 @@ export default class Channel implements PushAdapter {
/** Limit (bounds) after which the oldest buffered value is dropped. */
limit = Infinity,
) {
- this.pushBuffer = new LinkedQueue(limit);
- this.pullBuffer = new LinkedQueue(limit);
+ this.pushBuffer = new Buffer(limit);
+ this.pullBuffer = new Buffer(limit);
}
/**
diff --git a/src/index.ts b/src/index.ts
index 423e2b81..edd8e14e 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -2,7 +2,7 @@ export { default as Multicast } from './adapters/Multicast';
export { default as Channel, Unpushed, WrappedBalancer } from './adapters/Channel';
export { default as LastResult } from './adapters/LastResult';
export { default as Deferred } from './Deferred';
-export { default as LinkedQueue } from './LinkedQueue';
+export { default as Buffer } from './Buffer';
export { default as fromDom, Target, Listener, EventMap } from './fromDom';
export { default as fromEmitter } from './fromEmitter';
export { PushAdapter } from './common';