mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
20
.internal/copyArray.js
Normal file
20
.internal/copyArray.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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 = Array(length));
|
||||
while (++index < length) {
|
||||
array[index] = source[index];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
export default copyArray;
|
||||
Reference in New Issue
Block a user