X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcircular-array.ts;h=511b699c8827a2a214efe63e2fce9dfabfcee73a;hb=e1e012cc5e191a56cf5ec4939b3906dfc1eb3edb;hp=dadfa950043577a66d50387e59af621045bad66e;hpb=4077981dc9caec2cfac65c996ead75471321386c;p=poolifier.git diff --git a/src/circular-array.ts b/src/circular-array.ts index dadfa950..511b699c 100644 --- a/src/circular-array.ts +++ b/src/circular-array.ts @@ -1,9 +1,12 @@ -// Copyright Jerome Benoit. 2021-2023. All Rights Reserved. +// Copyright Jerome Benoit. 2021-2024. All Rights Reserved. -const DEFAULT_CIRCULAR_ARRAY_SIZE = 1024 +export const DEFAULT_CIRCULAR_ARRAY_SIZE = 1024 /** * Array with a maximum length and shifting items when full. + * + * @typeParam T - Type of items. + * @internal */ export class CircularArray extends Array { public size: number @@ -57,7 +60,7 @@ export class CircularArray extends Array { ...items: T[] ): CircularArray { let itemsRemoved: T[] = [] - if (arguments.length >= 3 && deleteCount !== undefined) { + if (arguments.length >= 3 && deleteCount != null) { itemsRemoved = super.splice(start, deleteCount, ...items) if (this.length > this.size) { const itemsOverflowing = super.splice(0, this.length - this.size)