1 |
3a515b92
|
cagy
|
var LazyWrapper = require('./_LazyWrapper');
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* Reverses the direction of lazy iteration.
|
5 |
|
|
*
|
6 |
|
|
* @private
|
7 |
|
|
* @name reverse
|
8 |
|
|
* @memberOf LazyWrapper
|
9 |
|
|
* @returns {Object} Returns the new reversed `LazyWrapper` object.
|
10 |
|
|
*/
|
11 |
|
|
function lazyReverse() {
|
12 |
|
|
if (this.__filtered__) {
|
13 |
|
|
var result = new LazyWrapper(this);
|
14 |
|
|
result.__dir__ = -1;
|
15 |
|
|
result.__filtered__ = true;
|
16 |
|
|
} else {
|
17 |
|
|
result = this.clone();
|
18 |
|
|
result.__dir__ *= -1;
|
19 |
|
|
}
|
20 |
|
|
return result;
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
module.exports = lazyReverse;
|