mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Bump to v4.7.0.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import cloneArrayBuffer from './_cloneArrayBuffer';
|
||||
import cloneDataView from './_cloneDataView';
|
||||
import cloneMap from './_cloneMap';
|
||||
import cloneRegExp from './_cloneRegExp';
|
||||
import cloneSet from './_cloneSet';
|
||||
@@ -16,6 +17,7 @@ var boolTag = '[object Boolean]',
|
||||
symbolTag = '[object Symbol]';
|
||||
|
||||
var arrayBufferTag = '[object ArrayBuffer]',
|
||||
dataViewTag = '[object DataView]',
|
||||
float32Tag = '[object Float32Array]',
|
||||
float64Tag = '[object Float64Array]',
|
||||
int8Tag = '[object Int8Array]',
|
||||
@@ -35,10 +37,11 @@ var arrayBufferTag = '[object ArrayBuffer]',
|
||||
* @private
|
||||
* @param {Object} object The object to clone.
|
||||
* @param {string} tag The `toStringTag` of the object to clone.
|
||||
* @param {Function} cloneFunc The function to clone values.
|
||||
* @param {boolean} [isDeep] Specify a deep clone.
|
||||
* @returns {Object} Returns the initialized clone.
|
||||
*/
|
||||
function initCloneByTag(object, tag, isDeep) {
|
||||
function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
||||
var Ctor = object.constructor;
|
||||
switch (tag) {
|
||||
case arrayBufferTag:
|
||||
@@ -48,13 +51,16 @@ function initCloneByTag(object, tag, isDeep) {
|
||||
case dateTag:
|
||||
return new Ctor(+object);
|
||||
|
||||
case dataViewTag:
|
||||
return cloneDataView(object, isDeep);
|
||||
|
||||
case float32Tag: case float64Tag:
|
||||
case int8Tag: case int16Tag: case int32Tag:
|
||||
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
|
||||
return cloneTypedArray(object, isDeep);
|
||||
|
||||
case mapTag:
|
||||
return cloneMap(object);
|
||||
return cloneMap(object, isDeep, cloneFunc);
|
||||
|
||||
case numberTag:
|
||||
case stringTag:
|
||||
@@ -64,7 +70,7 @@ function initCloneByTag(object, tag, isDeep) {
|
||||
return cloneRegExp(object);
|
||||
|
||||
case setTag:
|
||||
return cloneSet(object);
|
||||
return cloneSet(object, isDeep, cloneFunc);
|
||||
|
||||
case symbolTag:
|
||||
return cloneSymbol(object);
|
||||
|
||||
Reference in New Issue
Block a user