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.

33 lines
641 B

4 years ago
  1. var LodashWrapper = require('./_LodashWrapper');
  2. /**
  3. * Executes the chain sequence and returns the wrapped result.
  4. *
  5. * @name commit
  6. * @memberOf _
  7. * @since 3.2.0
  8. * @category Seq
  9. * @returns {Object} Returns the new `lodash` wrapper instance.
  10. * @example
  11. *
  12. * var array = [1, 2];
  13. * var wrapped = _(array).push(3);
  14. *
  15. * console.log(array);
  16. * // => [1, 2]
  17. *
  18. * wrapped = wrapped.commit();
  19. * console.log(array);
  20. * // => [1, 2, 3]
  21. *
  22. * wrapped.last();
  23. * // => 3
  24. *
  25. * console.log(array);
  26. * // => [1, 2, 3]
  27. */
  28. function wrapperCommit() {
  29. return new LodashWrapper(this.value(), this.__chain__);
  30. }
  31. module.exports = wrapperCommit;