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
658 B

пре 4 година
  1. var LazyWrapper = require('./_LazyWrapper'),
  2. LodashWrapper = require('./_LodashWrapper'),
  3. copyArray = require('./_copyArray');
  4. /**
  5. * Creates a clone of `wrapper`.
  6. *
  7. * @private
  8. * @param {Object} wrapper The wrapper to clone.
  9. * @returns {Object} Returns the cloned wrapper.
  10. */
  11. function wrapperClone(wrapper) {
  12. if (wrapper instanceof LazyWrapper) {
  13. return wrapper.clone();
  14. }
  15. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  16. result.__actions__ = copyArray(wrapper.__actions__);
  17. result.__index__ = wrapper.__index__;
  18. result.__values__ = wrapper.__values__;
  19. return result;
  20. }
  21. module.exports = wrapperClone;