Closed HatScripts closed 8 months ago
-
matcher.getAllMatches('nigger') results in an array of length 2, when it should only be 1. This causes the resulting censored string to be n*********r, when it should be n****r.
matcher.getAllMatches('nigger')
2
1
n*********r
n****r
import { RegExpMatcher, TextCensor, englishDataset, englishRecommendedTransformers, keepStartCensorStrategy, keepEndCensorStrategy, asteriskCensorStrategy } from 'obscenity' const matcher = new RegExpMatcher({ ...englishDataset.build(), ...englishRecommendedTransformers }) const strategy = keepStartCensorStrategy(keepEndCensorStrategy(asteriskCensorStrategy())) const censor = new TextCensor().setStrategy(strategy) const input = 'nigger' const matches = matcher.getAllMatches(input) console.log(matches) console.log(censor.applyTo(input, matches))
No response
N/A
v0.1.4
This should be fixed in the newest release of Obscenity; please let me know if it persists for you.
It's working as expected now. Thank you!
Expected behavior
-
Actual behavior
matcher.getAllMatches('nigger')
results in an array of length2
, when it should only be1
. This causes the resulting censored string to ben*********r
, when it should ben****r
.Minimal reproducible example
Steps to reproduce
Additional context
No response
Node.js version
N/A
Obscenity version
v0.1.4
Priority
Terms