chore: initial import

This commit is contained in:
liangjian
2026-06-29 09:42:53 +08:00
commit 9fea127de1
241 changed files with 82767 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/**
* 判断是否为数组
*
* @param {Object} arr
*/
function isArray(arr) {
return Object.prototype.toString.call(arr) === '[object Array]'
}
/**
* 深度复制数据
*
* @param {Object} obj
*/
function deepClone(obj) {
if ([null, undefined, NaN, false].includes(obj)) return obj
if (typeof obj !== 'object' && typeof obj !== 'function') {
return obj
}
var o = isArray(obj) ? [] : {}
for (let i in obj) {
if (obj.hasOwnProperty(i)) {
o[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i]
}
}
return o
}
export default deepClone