source: imaps-frontend/node_modules/lodash-es/wrapperReverse.js

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: 1017 bytes
RevLine 
[d565449]1import LazyWrapper from './_LazyWrapper.js';
2import LodashWrapper from './_LodashWrapper.js';
3import reverse from './reverse.js';
4import thru from './thru.js';
5
6/**
7 * This method is the wrapper version of `_.reverse`.
8 *
9 * **Note:** This method mutates the wrapped array.
10 *
11 * @name reverse
12 * @memberOf _
13 * @since 0.1.0
14 * @category Seq
15 * @returns {Object} Returns the new `lodash` wrapper instance.
16 * @example
17 *
18 * var array = [1, 2, 3];
19 *
20 * _(array).reverse().value()
21 * // => [3, 2, 1]
22 *
23 * console.log(array);
24 * // => [3, 2, 1]
25 */
26function wrapperReverse() {
27 var value = this.__wrapped__;
28 if (value instanceof LazyWrapper) {
29 var wrapped = value;
30 if (this.__actions__.length) {
31 wrapped = new LazyWrapper(this);
32 }
33 wrapped = wrapped.reverse();
34 wrapped.__actions__.push({
35 'func': thru,
36 'args': [reverse],
37 'thisArg': undefined
38 });
39 return new LodashWrapper(wrapped, this.__chain__);
40 }
41 return this.thru(reverse);
42}
43
44export default wrapperReverse;
Note: See TracBrowser for help on using the repository browser.