fix:代码规范

This commit is contained in:
junjie
2021-06-24 13:54:58 +08:00
parent 076a66ed96
commit 09aaaedeb4
25 changed files with 506 additions and 506 deletions

View File

@@ -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)
}