main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
842 bytes
|
Rev | Line | |
---|
[d565449] | 1 | /** Used for built-in method references. */
|
---|
| 2 | var arrayProto = Array.prototype;
|
---|
| 3 |
|
---|
| 4 | /* Built-in method references for those with the same name as other `lodash` methods. */
|
---|
| 5 | var nativeReverse = arrayProto.reverse;
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * Reverses `array` so that the first element becomes the last, the second
|
---|
| 9 | * element becomes the second to last, and so on.
|
---|
| 10 | *
|
---|
| 11 | * **Note:** This method mutates `array` and is based on
|
---|
| 12 | * [`Array#reverse`](https://mdn.io/Array/reverse).
|
---|
| 13 | *
|
---|
| 14 | * @static
|
---|
| 15 | * @memberOf _
|
---|
| 16 | * @since 4.0.0
|
---|
| 17 | * @category Array
|
---|
| 18 | * @param {Array} array The array to modify.
|
---|
| 19 | * @returns {Array} Returns `array`.
|
---|
| 20 | * @example
|
---|
| 21 | *
|
---|
| 22 | * var array = [1, 2, 3];
|
---|
| 23 | *
|
---|
| 24 | * _.reverse(array);
|
---|
| 25 | * // => [3, 2, 1]
|
---|
| 26 | *
|
---|
| 27 | * console.log(array);
|
---|
| 28 | * // => [3, 2, 1]
|
---|
| 29 | */
|
---|
| 30 | function reverse(array) {
|
---|
| 31 | return array == null ? array : nativeReverse.call(array);
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | export default reverse;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.