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