Commit 235121d 1 parent b398740 commit 235121d Copy full SHA for 235121d
File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class Filter {
31
31
return this . list
32
32
. filter ( ( word ) => {
33
33
const wordExp = new RegExp ( `\\b${ word . replace ( / ( \W ) / g, '\\$1' ) } \\b` , 'gi' ) ;
34
- return ! this . exclude . includes ( word ) && wordExp . test ( string ) ;
34
+ return ! this . exclude . includes ( word . toLowerCase ( ) ) && wordExp . test ( string ) ;
35
35
} )
36
36
. length > 0 || false ;
37
37
}
@@ -65,19 +65,21 @@ class Filter {
65
65
66
66
this . list . push ( ...words ) ;
67
67
68
- words . forEach ( ( word ) => {
69
- if ( this . exclude . includes ( word ) ) {
70
- this . exclude . splice ( this . exclude . indexOf ( word ) , 1 ) ;
71
- }
72
- } ) ;
68
+ words
69
+ . map ( word => word . toLowerCase ( ) )
70
+ . forEach ( ( word ) => {
71
+ if ( this . exclude . includes ( word ) ) {
72
+ this . exclude . splice ( this . exclude . indexOf ( word ) , 1 ) ;
73
+ }
74
+ } ) ;
73
75
}
74
76
75
77
/**
76
78
* Add words to whitelist filter
77
79
* @param {...string } word - Word(s) to add to whitelist.
78
80
*/
79
81
removeWords ( ) {
80
- this . exclude . push ( ...Array . from ( arguments ) ) ;
82
+ this . exclude . push ( ...Array . from ( arguments ) . map ( word => word . toLowerCase ( ) ) ) ;
81
83
}
82
84
}
83
85
You can’t perform that action at this time.
0 commit comments