deduplication 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +9 -3
- package/package.json +1 -1
- package/vertify.html +0 -0
package/index.js
CHANGED
@@ -3,20 +3,26 @@
|
|
3
3
|
* @param arr 要去重的数组
|
4
4
|
* @param type number type为1表示使用set函数去重,type为2表示使用
|
5
5
|
*/
|
6
|
-
|
6
|
+
function deduplication(arr,type=1) {
|
7
7
|
switch(type){
|
8
8
|
case 1:
|
9
|
-
|
9
|
+
method1(arr);
|
10
10
|
break;
|
11
11
|
case 2:
|
12
|
-
|
12
|
+
method2(arr);
|
13
13
|
break;
|
14
14
|
}
|
15
15
|
|
16
16
|
}
|
17
|
+
module.exports=deduplication;
|
18
|
+
|
17
19
|
|
18
20
|
//set去重
|
19
21
|
function method1(arr){
|
20
22
|
let a = new Set(arr);
|
21
23
|
return [...a];
|
22
24
|
}
|
25
|
+
|
26
|
+
function method2(arr) {
|
27
|
+
|
28
|
+
}
|
package/package.json
CHANGED
package/vertify.html
DELETED
File without changes
|