Allow unbound circular array size
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 13 May 2021 17:41:40 +0000 (19:41 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 13 May 2021 17:41:40 +0000 (19:41 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/CircularArray.ts

index 9fde8be78c159411bf6708c49893bb6f23f9d4c5..3e489f640fe3f4e0ca92091fb1b8adb32b39458a 100644 (file)
@@ -1,11 +1,11 @@
 
 export default class CircularArray<T> extends Array<T> {
   public size: number;
-  private readonly defaultMaximumCircularArraySize = 2000;
+  private readonly defaultCircularArraySize = 2000;
 
   constructor(size?: number) {
     super();
-    this.size = size && size <= this.defaultMaximumCircularArraySize ? size : this.defaultMaximumCircularArraySize;
+    this.size = size ?? this.defaultCircularArraySize;
   }
 
   public push(...items: T[]): number {