Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reverse.js 844B

12345678910111213141516171819202122232425262728293031323334
  1. /** Used for built-in method references. */
  2. var arrayProto = Array.prototype;
  3. /* Built-in method references for those with the same name as other `lodash` methods. */
  4. var nativeReverse = arrayProto.reverse;
  5. /**
  6. * Reverses `array` so that the first element becomes the last, the second
  7. * element becomes the second to last, and so on.
  8. *
  9. * **Note:** This method mutates `array` and is based on
  10. * [`Array#reverse`](https://mdn.io/Array/reverse).
  11. *
  12. * @static
  13. * @memberOf _
  14. * @since 4.0.0
  15. * @category Array
  16. * @param {Array} array The array to modify.
  17. * @returns {Array} Returns `array`.
  18. * @example
  19. *
  20. * var array = [1, 2, 3];
  21. *
  22. * _.reverse(array);
  23. * // => [3, 2, 1]
  24. *
  25. * console.log(array);
  26. * // => [3, 2, 1]
  27. */
  28. function reverse(array) {
  29. return array == null ? array : nativeReverse.call(array);
  30. }
  31. module.exports = reverse;