From db89e3bcb546d7302179437c4fa88d6fd03bccf0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 21 May 2024 23:19:38 +0200 Subject: [PATCH] docs: refine circular buffer code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/circular-buffer.ts | 17 ++++++++++------- src/pools/abstract-pool.ts | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/circular-buffer.ts b/src/circular-buffer.ts index baa92192..9f9678d1 100644 --- a/src/circular-buffer.ts +++ b/src/circular-buffer.ts @@ -1,10 +1,13 @@ /** - * Default buffer size + * Default buffer size. */ export const defaultBufferSize = 2048 /** * Circular buffer + * + * @typeParam T - Type of buffer data. + * @internal */ export class CircularBuffer { private readonly readIdx: number @@ -13,8 +16,8 @@ export class CircularBuffer { private readonly maxArrayIdx: number /** - * @param size - Buffer size - * @returns CircularBuffer + * @param size - Buffer size. @defaultValue defaultBufferSize + * @returns CircularBuffer. */ constructor (size: number = defaultBufferSize) { this.checkSize(size) @@ -25,9 +28,9 @@ export class CircularBuffer { } /** - * Puts data into buffer + * Puts data into buffer. * - * @param data - Data to put into buffer + * @param data - Data to put into buffer. */ public put (data: T): void { this.items[this.writeIdx] = data @@ -35,9 +38,9 @@ export class CircularBuffer { } /** - * Returns buffer as array + * Returns buffer as array. * - * @returns T[] + * @returns Array of buffer data. */ public toArray (): T[] { return this.items.filter(item => item != null) as T[] diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index a7d3e944..ebdb0dd8 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1473,7 +1473,7 @@ export abstract class AbstractPool< * Chooses a worker node for the next task. * * @param name - The task function name. - * @returns The chosen worker node key + * @returns The chosen worker node key. */ private chooseWorkerNode (name?: string): number { if (this.shallCreateDynamicWorker()) { -- 2.34.1