(arr: T[], separator: K)
| 9 | * @example joinArray([1, 2, 3], '5') => [1, '5', 2, '5', 3] |
| 10 | */ |
| 11 | export function joinArray<T, K>(arr: T[], separator: K): (T | K)[] { |
| 12 | return _flatten( |
| 13 | arr.map((item, i) => { |
| 14 | if (i === 0) { |
| 15 | return [item]; |
| 16 | } else { |
| 17 | return [separator, item]; |
| 18 | } |
| 19 | }) |
| 20 | ); |
| 21 | } |
no outgoing calls
no test coverage detected