Skip to content

Commit fcb43f7

Browse files
committed
add null check for commentTriggers and directiveTriggers
1 parent 75a1ac7 commit fcb43f7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ function removeSelective(path, t, directiveTriggers, commentTriggers) {
88
if (t.isDirective(sibling)) { // if the sibiling is a directive
99
if (
1010
sibling.value.value === 'not strict' ||
11-
(directiveTriggers.length && directiveTriggers.includes(sibling.value.value)) // extra directive triggers
11+
(commentTriggers && directiveTriggers.includes && directiveTriggers.includes(sibling.value.value)) // extra directive triggers
1212
) { // check if its 'not strict'
1313
path.remove(); // remove 'use strict'
1414
break;
1515
}
1616
}
1717

1818
// remove based on comment triggers
19-
if (commentTriggers.length) {
19+
if (commentTriggers && commentTriggers.includes) {
2020
if (sibling.leadingComments) {
2121
let foundInLeadingComment = false;
2222
for (const leadingComment of sibling.leadingComments) {

0 commit comments

Comments
 (0)