Skip to content

Commit 519de45

Browse files
committed
add extra directive triggers
1 parent c8eea44 commit 519de45

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
function removeSelective(path, t, directiveTriggers, commentTriggers) {
55
if (path.node.value.value === 'use strict') {
66
const siblings = path.container // get all the sibilings (code in the same level) of 'use strict'
7-
87
for (const sibling of siblings) {
98
if (t.isDirective(sibling)) { // if the sibiling is a directive
10-
if (sibling.value.value === 'not strict') { // check if its 'not strict'
9+
if (
10+
sibling.value.value === 'not strict' ||
11+
(directiveTriggers.length && directiveTriggers.includes(sibling.value.value)) // extra directive triggers
12+
) { // check if its 'not strict'
1113
path.remove(); // remove 'use strict'
1214
break;
1315
}
@@ -47,6 +49,7 @@ function removeSelective(path, t, directiveTriggers, commentTriggers) {
4749
}
4850
}
4951

52+
5053
// remove for all files
5154
function removeAll(path) {
5255
if (path.node.value.value === 'use strict') {

0 commit comments

Comments
 (0)