Skip to content

Latest commit

 

History

History
38 lines (23 loc) · 1.01 KB

File metadata and controls

38 lines (23 loc) · 1.01 KB

obscenity


obscenity / keepEndCensorStrategy

Function: keepEndCensorStrategy()

keepEndCensorStrategy(baseStrategy): TextCensorStrategy

Defined in: src/censor/BuiltinStrategies.ts:51

A text censoring strategy that extends another strategy, adding the last character matched at the end of the generated string.

Parameters

baseStrategy

TextCensorStrategy

Strategy to extend. It will be used to produce the start of the generated string.

Returns

TextCensorStrategy

A [[TextCensorStrategy]] for use with the [[TextCensor]].

Example

const strategy = keepEndCensorStrategy(asteriskCensorStrategy());
const censor = new TextCensor().setStrategy(strategy);
// Before: 'fuck you'
// After: '***k you'