Skip to content

Commit 15caebe

Browse files
committed
Add extra safety hook
1 parent bce6f82 commit 15caebe

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/util/safe.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ function safe(context, input, config) {
3131
while (++index < length) {
3232
pattern = patterns[index]
3333

34-
if (!inScope(context.stack, pattern.inConstruct)) {
34+
if (
35+
!inScope(context.stack, pattern.inConstruct, true) ||
36+
inScope(context.stack, pattern.notInConstruct)
37+
) {
3538
continue
3639
}
3740

@@ -89,12 +92,12 @@ function safe(context, input, config) {
8992
return result.join('')
9093
}
9194

92-
function inScope(stack, list) {
95+
function inScope(stack, list, none) {
9396
var length
9497
var index
9598

9699
if (!list) {
97-
return true
100+
return none
98101
}
99102

100103
if (typeof list === 'string') {

0 commit comments

Comments
 (0)