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.

23 lines
491 B

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