11 lines
229 B
TypeScript
11 lines
229 B
TypeScript
export function copyArray(source: any, array: any) {
|
|
let index = -1
|
|
const length = source.length
|
|
|
|
array || (array = Array.from({ length }))
|
|
while (++index < length) {
|
|
array[index] = source[index]
|
|
}
|
|
return array
|
|
}
|