UNPKG
lulouis-vant
Version:
latest (1.5.9)
1.5.9
1.5.8
Lightweight Mobile UI Components built on Vue
github.com/lulouis/vant
lulouis/vant
lulouis-vant
/
es
/
utils
/
deep-clone.js
14 lines
(12 loc)
•
274 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
deepAssign
from
'./deep-assign'
;
export
default
function
deepClone
(
obj
) {
if
(
Array
.
isArray
(obj)) {
return
obj.
map
(
function
(
item
) {
return
deepClone
(item); }); }
if
(
typeof
obj ===
'object'
) {
return
deepAssign
({}, obj); }
return
obj; }