blob: cd94d5d09a10dd9f14d2657fe52026c555795f57 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001/**
2 * Copies the values of `source` to `array`.
3 *
4 * @private
5 * @param {Array} source The array to copy values from.
6 * @param {Array} [array=[]] The array to copy values to.
7 * @returns {Array} Returns `array`.
8 */
9function copyArray(source, array) {
10 var index = -1,
11 length = source.length;
12
13 array || (array = Array(length));
14 while (++index < length) {
15 array[index] = source[index];
16 }
17 return array;
18}
19
20module.exports = copyArray;