Skip to content

Commit 578221c

Browse files
committed
feature: @putout/plugin-remove-duplicate-case: no node
1 parent b3858bc commit 578221c

4 files changed

Lines changed: 54 additions & 2 deletions

File tree

packages/plugin-remove-duplicate-case/lib/remove-duplicate-case.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ export const traverse = ({push}) => ({
1919
const current = cases[i].get('test');
2020

2121
for (let j = 0; j < length; j++) {
22-
const duplicate = cases[j].get('test');
23-
2422
if (j === i)
2523
continue;
2624

25+
const currentCase = cases[j].node;
26+
27+
if (!currentCase)
28+
continue;
29+
30+
const duplicate = currentCase.test;
31+
2732
if (compare(duplicate, current)) {
2833
push(current);
2934
break;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
switch(keyCode) {
2+
case KEY.G:
3+
if (alt) {
4+
DOM.goToDirectory();
5+
event.preventDefault();
6+
}
7+
8+
break;
9+
10+
case KEY.L:
11+
if (ctrlMeta) {
12+
CloudCmd.logOut();
13+
event.preventDefault();
14+
}
15+
16+
break;
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
switch(keyCode) {
2+
case KEY.G:
3+
if (alt) {
4+
DOM.goToDirectory();
5+
event.preventDefault();
6+
}
7+
8+
break;
9+
10+
case KEY.L:
11+
if (ctrlMeta) {
12+
CloudCmd.logOut();
13+
event.preventDefault();
14+
}
15+
16+
break;
17+
18+
case KEY.L:
19+
if (ctrlMeta) {
20+
CloudCmd.logOut();
21+
event.preventDefault();
22+
}
23+
24+
break;
25+
}

packages/plugin-remove-duplicate-case/test/remove-duplicate-case.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ test('remove duplicate-case: transform: case', (t) => {
1717
t.end();
1818
});
1919

20+
test('remove duplicate-case: transform: member', (t) => {
21+
t.transform('member');
22+
t.end();
23+
});
24+
2025
test('remove duplicate-case: no transform: no-duplicate', (t) => {
2126
t.noTransform('no-duplicate');
2227
t.end();

0 commit comments

Comments
 (0)