Open gpmcadam opened 4 years ago
I am pretty sure you add words in arguments and not array, like bw.addWords('foo-bar', 'foobar')
and when I did that both returned true, which from documentation is the expected result
The same happens with underscores
const filter = new Filter({ list: ['some', 'bad', 'word'] });
[
filter.isProfane("some bad word"),
filter.isProfane("some_bad_word")
]
// [ true, false ]
The library is only meant to check between word boundaries, so I would not say it is a bug.
Then maybe this should be a feature request... its also a problem with words merged together with no boundary.
const filter = new Filter({ list: ['some', 'bad', 'word'] });
[
filter.isProfane("some bad word"),
filter.isProfane("somebadword")
]
// [ true, false ]
When really offensive words are used like this, it doesn't matter if there are spaces, its still offensive and should be considered profane...
Given the example below:
I would expect
bw.isProfine('foo-bar')
to return"foo-bar"
and notfalse
.