mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Bump to v4.0.0.
This commit is contained in:
41
lodash.reverse/index.js
Normal file
41
lodash.reverse/index.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* lodash 4.0.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var arrayProto = global.Array.prototype;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeReverse = arrayProto.reverse;
|
||||
|
||||
/**
|
||||
* Reverses `array` so that the first element becomes the last, the second
|
||||
* element becomes the second to last, and so on.
|
||||
*
|
||||
* **Note:** This method mutates `array` and is based on
|
||||
* [`Array#reverse`](https://mdn.io/Array/reverse).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3];
|
||||
*
|
||||
* _.reverse(array);
|
||||
* // => [3, 2, 1]
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [3, 2, 1]
|
||||
*/
|
||||
function reverse(array) {
|
||||
return array ? nativeReverse.call(array) : array;
|
||||
}
|
||||
|
||||
module.exports = reverse;
|
||||
Reference in New Issue
Block a user