Closed JasonPierce closed 2 years ago
A better solution might be to replace the userPartialGrawlix
param with grawlixReplacementType
, which supports the following values
all
: this is the current functionality, and would remain the default.firstChar
: the first char of the profane word is replaced with the grawlixCharfirstVowel
: the first vowel in the profane word is replaced with the grawlixCharallVowels
: all vowels in the profane word are replaced with the grawlixChar. This would implement the functionality of this ticket's original designThe grawlixChar
option would replace the partialGrawlix
option, in this design. 🤔
I went with slightly different implementation than the original vision I had for this new feature:
A new, optional, CensorType
param has been added to the censor
function:
Word
: this is the default functionality of the censor
function when no CensorType
is specified. This option matches the original functionality of the lib (i.e., before this feature was implemented)FirstChar
: the first char of the profane word is replaced with the ProfanityOptions.grawlixChar
FirstVowel
: the first vowel in the profane word is replaced with the ProfanityOptions.grawlixChar
AllVowels
: all vowels in the profane word are replaced with the ProfanityOptions.grawlixChar
A new ProfanityOptions.grawlixChar
option has been added, which defaults to *
Presently, the
censor
method replaces the entire profane word with a grawlix. Thought it might be cool to add an option that only replaces the vowels in a profane word.Acceptance Criteria
usePartialGrawlix
param to thecensor
method. Default tofalse
.partialGrawlix
option toProfanityOptions
. Defaults to'*'
.usePartialGrawlix
istrue
, instead of the entire profane word being replaced with thegrawlix
, only the vowels are replaced within the profane word. Each vowel is replaced with thepartialGrawlix
value.Example
Configure
Usage