(items: T[] | undefined = undefined, capacity: number = 100)
| 31 | private _defaultCapacity: number |
| 32 | |
| 33 | constructor(items: T[] | undefined = undefined, capacity: number = 100) { |
| 34 | this._defaultCapacity = capacity |
| 35 | if (!items) { |
| 36 | items = [] |
| 37 | } |
| 38 | this._items = items.length |
| 39 | ? [ |
| 40 | ...items, |
| 41 | ...repeated(undefined as T, Math.max(0, capacity - items.length)), |
| 42 | ] |
| 43 | : [undefined as T] |
| 44 | this._head = 0 |
| 45 | this._length = items.length |
| 46 | } |
| 47 | |
| 48 | static from<T>(iterable: Iterable<T>): Queue<T> { |
| 49 | return new Queue<T>([...iterable]) |
nothing calls this directly
no test coverage detected