X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcircular-array.ts;h=40bd19ae0fc74742380979fe05712a5e962251c6;hb=77492f2e943e5ca2922e36c345816168298e8090;hp=8adf4b5fb6ec2a49b3d2e0e3e0d6fe4e6237c5a7;hpb=78099a150dc54d7adab495195fa5f133fd54e114;p=poolifier.git diff --git a/src/circular-array.ts b/src/circular-array.ts index 8adf4b5f..40bd19ae 100644 --- a/src/circular-array.ts +++ b/src/circular-array.ts @@ -3,7 +3,7 @@ const DEFAULT_CIRCULAR_ARRAY_SIZE = 1024 /** - * Array with a maximum length shifting items when full. + * Array with a maximum length and shifting items when full. */ export class CircularArray extends Array { public size: number @@ -17,6 +17,7 @@ export class CircularArray extends Array { } } + /** @inheritDoc */ public push (...items: T[]): number { const length = super.push(...items) if (length > this.size) { @@ -25,6 +26,7 @@ export class CircularArray extends Array { return this.length } + /** @inheritDoc */ public unshift (...items: T[]): number { const length = super.unshift(...items) if (length > this.size) { @@ -33,6 +35,7 @@ export class CircularArray extends Array { return this.length } + /** @inheritDoc */ public concat (...items: Array>): CircularArray { const concatenatedCircularArray = super.concat( items as T[] @@ -47,6 +50,7 @@ export class CircularArray extends Array { return concatenatedCircularArray } + /** @inheritDoc */ public splice (start: number, deleteCount?: number, ...items: T[]): T[] { let itemsRemoved: T[] if (arguments.length >= 3 && deleteCount !== undefined) {