/**
 * Copies the values of `source` to `array`.
 *
 * @private
 * @param {Array} source The array to copy values from.
 * @param {Array} [array=[]] The array to copy values to.
 * @returns {Array} Returns `array`.
 */
function copyArray<T>(source: ArrayLike<T> | Array<T>, array?: Array<any>): Array<T> {
    let index = -1;
    const length = source.length;

    array || (array = new Array(length));
    while (++index < length) {
        array[index] = source[index];
    }
    return array;
}

export default copyArray;
// /**
//  * Copies the values of `source` to `array`.
//  *
//  * @private
//  * @param {Array} source The array to copy values from.
//  * @param {Array} [array=[]] The array to copy values to.
//  * @returns {Array} Returns `array`.
//  */
// function copyArray(source, array) {
//     let index = -1;
//     const length = source.length;

//     array || (array = new Array(length));
//     while (++index < length) {
//         array[index] = source[index];
//     }
//     return array;
// }

// export default copyArray;
