Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
454 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /**
|
---|
| 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 | */
|
---|
| 9 | function 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 |
|
---|
| 20 | module.exports = copyArray;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.