标签:工具 ons type array one == tostring pre cos
const type= obj =>{cosnt deepClone = data =>{
var t = type( data)
var i ;
var o;
var length;
if( t ===‘obejct‘){
o = {}
}else if ( t == ‘array‘){
o= []
}
if( t === ‘array‘){
for( let i=0,length =data.length ;i<length;i++){
o.push( deepClone(data[i])
}
return o;
}
if(t ===‘object‘){
for( let item in data){
o[item] = deepClone(data[i]);
}
return o
}
}
标签:工具 ons type array one == tostring pre cos
原文地址:https://blog.51cto.com/14582569/2546039