_arrayPush.js 437 B

123456789101112131415161718192021
  1. /**
  2. * Appends the elements of `values` to `array`.
  3. *
  4. * @private
  5. * @param {Array} array The array to modify.
  6. * @param {Array} values The values to append.
  7. * @returns {Array} Returns `array`.
  8. */
  9. function arrayPush(array, values) {
  10. var index = -1,
  11. length = values.length,
  12. offset = array.length;
  13. while (++index < length) {
  14. array[offset + index] = values[index];
  15. }
  16. return array;
  17. }
  18. module.exports = arrayPush;