Skip to content

Commit 58f0c32

Browse files
author
Chu·Fan
authored
Merge pull request #42 from 142vip/next
feat: 一些新的文档总结
2 parents 0cac6ac + 103b42a commit 58f0c32

File tree

218 files changed

+4604
-1907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+4604
-1907
lines changed

.gitignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ logs
1111
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
1212

1313
# docs/.vuepress
14-
15-
# Runtime data
1614
pids
1715
*.pid
1816
*.seed
@@ -77,15 +75,12 @@ typings/
7775
# Next.js build output
7876
.next
7977

80-
# Nuxt.js build / generate output
8178
.nuxt
8279
dist
8380

8481
# Gatsby files
8582
.cache/
86-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
87-
# https://nextjs.org/blog/next-9-1#public-directory-support
88-
# public
83+
8984

9085
# vuepress build output
9186
# .vuepress/dist
@@ -99,3 +94,4 @@ docs/.vuepress/dist/
9994
# TernJS port file
10095
.tern-port
10196
/docs/.vuepress/.temp/
97+
/.husky/

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
npm run lintfix && git add .
4+
npm run lintfix

code/algorithm/debounce.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function debounce(func, time) {
88
return () => {
99
clearTimeout(timeout)
1010
timeout = setTimeout(() => {
11+
// 执行函数
1112
func.apply(this, arguments)
1213
// func()
1314
}, time)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/**
2-
* 判断数据类型
3-
* @param target
4-
*/
5-
function checkType(target) {
6-
// 判断类型 -typeof -instanceof -toString.call() -Array.isArray()
7-
return Object.prototype.toString.call(target).slice(8, -1)
8-
}
91

102
/**
113
* 基于Json序列化的深拷贝【不能处理函数】
@@ -15,21 +7,23 @@ function DeepCloneByJSON(target) {
157
return JSON.parse(JSON.stringify(target))
168
}
179

18-
// 基于递归思想的深拷贝
10+
/**
11+
* 基于递归思想的深拷贝
12+
* @param target
13+
* @returns {{}|*}
14+
* @constructor
15+
*/
1916
function DeepClone(target) {
2017
let result
2118
const targetType = checkType(target)
22-
2319
if (targetType === 'object') {
2420
// 处理对象
2521
result = {}
26-
} else if (targetType === 'Array') {
27-
// 处理数组
22+
}
23+
if (targetType === 'Array') {
2824
result = []
29-
} else {
30-
// 其他数据类型或者函数
31-
return result
3225
}
26+
3327
// 遍历目标数据
3428
for (const key in target) {
3529
// 获取每一项值
@@ -39,3 +33,12 @@ function DeepClone(target) {
3933
}
4034
return result
4135
}
36+
37+
/**
38+
* 判断数据类型
39+
* @param target
40+
*/
41+
function checkType(target) {
42+
// typeof -instanceof -toString.call() -Array.isArray()
43+
return Object.prototype.toString.call(target).slice(8, -1)
44+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)