(items: Array<T>, item: T, max = 0)
| 431 | } |
| 432 | |
| 433 | export function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> { |
| 434 | const newItems = [...items, item] |
| 435 | return max && newItems.length > max ? newItems.slice(1) : newItems |
| 436 | } |
| 437 | |
| 438 | export function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> { |
| 439 | const newItems = [item, ...items] |
no outgoing calls
no test coverage detected