(arr: T[], index: number)
| 23 | * @return {Array} the array instance |
| 24 | */ |
| 25 | export function spliceOne<T = any>(arr: T[], index: number): T[] { |
| 26 | if (index < 0) { |
| 27 | index = arr.length + index; |
| 28 | // still negative, not found element |
| 29 | if (index < 0) { |
| 30 | return arr; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | // don't touch |
| 35 | if (index >= arr.length) { |
| 36 | return arr; |
| 37 | } |
| 38 | |
| 39 | for (let i = index, k = i + 1, n = arr.length; k < n; i += 1, k += 1) { |
| 40 | arr[i] = arr[k]; |
| 41 | } |
| 42 | arr.pop(); |
| 43 | return arr; |
| 44 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…