(items: Array<T>, item: T, max = 0)
| 422 | } |
| 423 | |
| 424 | export function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> { |
| 425 | const newItems = [...items, item] |
| 426 | return max && newItems.length > max ? newItems.slice(1) : newItems |
| 427 | } |
| 428 | |
| 429 | export function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> { |
| 430 | const newItems = [item, ...items] |
no outgoing calls
no test coverage detected