UNPKG

@feugene/mu

Version:

Helpful TS utilities without dependencies

21 lines 589 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.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; } //# sourceMappingURL=copyArray.js.map