mirror of
https://github.com/dataease/dataease.git
synced 2026-05-23 22:08:34 +08:00
fix:代码规范
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
export function deepCopy(target) {
|
||||
if (typeof target == 'object') {
|
||||
const result = Array.isArray(target)? [] : {}
|
||||
for (const key in target) {
|
||||
if (typeof target[key] == 'object') {
|
||||
result[key] = deepCopy(target[key])
|
||||
} else {
|
||||
result[key] = target[key]
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
if (typeof target === 'object') {
|
||||
const result = Array.isArray(target) ? [] : {}
|
||||
for (const key in target) {
|
||||
if (typeof target[key] === 'object') {
|
||||
result[key] = deepCopy(target[key])
|
||||
} else {
|
||||
result[key] = target[key]
|
||||
}
|
||||
}
|
||||
|
||||
return target
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
return target
|
||||
}
|
||||
|
||||
export function swap(arr, i, j) {
|
||||
const temp = arr[i]
|
||||
arr[i] = arr[j]
|
||||
arr[j] = temp
|
||||
const temp = arr[i]
|
||||
arr[i] = arr[j]
|
||||
arr[j] = temp
|
||||
}
|
||||
|
||||
export function $(selector) {
|
||||
return document.querySelector(selector)
|
||||
}
|
||||
return document.querySelector(selector)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user