(array: any[], from: number, to: number)
| 1 | export function move(array: any[], from: number, to: number) { |
| 2 | const max = array.length - 1; |
| 3 | if (from > max || to > max || from < 0 || to < 0) { |
| 4 | return array; |
| 5 | } |
| 6 | const copy = [...array]; |
| 7 | const item = copy.splice(from, 1)[0]; |
| 8 | copy.splice(to, 0, item); |
| 9 | return copy; |
| 10 | } |
| 11 | |
| 12 | export function unionBy( |
| 13 | array1: { [key: string]: any }[], |
no outgoing calls
no test coverage detected