Skip to content

Commit 3c58e14

Browse files
committed
chore(release): 0.2.0
1 parent 5bb1ef1 commit 3c58e14

21 files changed

+105
-79
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [0.2.0](https://github.com/jo3-l/obscenity/compare/v0.1.4...v0.2.0) (2024-01-05)
6+
7+
8+
### ⚠ BREAKING CHANGES
9+
10+
* **english-preset:** Using the default English preset, Obscenity will no longer strip non-alphabetic characters from the input text before matching.
11+
12+
This addresses a class of egregious false negatives in previous versions (see #23), but introduces a regression where cases such as 'f u c k' (with the space) will no longer be detected by default. We expect to provide a more comprehensive fix in the next minor release.
13+
14+
If desired, it remains possible to revert to the previous behavior by providing a custom set of transformers to the matcher.
15+
* **matchers:** The NfaMatcher class has been removed. Use the RegExpMatcher instead.
16+
17+
### Features
18+
19+
* **english-preset:** blacklist 'shit' by default ([b0d90aa](https://github.com/jo3-l/obscenity/commit/b0d90aa4b7dd6d15a2105490f1d2b0c87e58bdcf)), closes [#47](https://github.com/jo3-l/obscenity/issues/47)
20+
21+
22+
### Bug Fixes
23+
24+
* **english-preset:** don't include skip-non-alphabetic transformer ([620c721](https://github.com/jo3-l/obscenity/commit/620c721662c3ddd8d8ca8838861b9c4ba3ea66e7)), closes [#23](https://github.com/jo3-l/obscenity/issues/23) [#46](https://github.com/jo3-l/obscenity/issues/46)
25+
* **english-preset:** remove extraneous patterns for n-word ([e135be5](https://github.com/jo3-l/obscenity/commit/e135be58510149db9b678801a2e6e3468b3bd4bb)), closes [#48](https://github.com/jo3-l/obscenity/issues/48)
26+
* **pkg:** ensure types resolve in ESM ([718da8a](https://github.com/jo3-l/obscenity/commit/718da8a7399c0dcf948fbe8041714ad6d61c9f73)), closes [#44](https://github.com/jo3-l/obscenity/issues/44)
27+
28+
29+
* **matchers:** remove NfaMatcher ([b69c21d](https://github.com/jo3-l/obscenity/commit/b69c21d178ac5e3270fd35d2b876263045a67d81))
30+
531
### [0.1.4](https://github.com/jo3-l/obscenity/compare/v0.1.1...v0.1.4) (2023-06-06)
632

733
### Bug Fixes

docs/reference/README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Context passed to [[TextCensorStrategy | text censoring strategies]].
7878

7979
#### Defined in
8080

81-
[src/censor/TextCensor.ts:104](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/TextCensor.ts#L104)
81+
[src/censor/TextCensor.ts:104](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/TextCensor.ts#L104)
8282

8383
___
8484

@@ -92,7 +92,7 @@ should be a set of characters that map to the transformed character.
9292

9393
#### Defined in
9494

95-
[src/transformer/remap-characters/index.ts:60](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/remap-characters/index.ts#L60)
95+
[src/transformer/remap-characters/index.ts:60](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/remap-characters/index.ts#L60)
9696

9797
___
9898

@@ -104,7 +104,7 @@ All the profane words that are included in the [[englishDataset | english datase
104104

105105
#### Defined in
106106

107-
[src/preset/english.ts:383](https://github.com/jo3-l/obscenity/blob/0b48eca/src/preset/english.ts#L383)
107+
[src/preset/english.ts:383](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/preset/english.ts#L383)
108108

109109
___
110110

@@ -122,7 +122,7 @@ Extends the default match payload by adding phrase metadata.
122122

123123
#### Defined in
124124

125-
[src/dataset/DataSet.ts:190](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L190)
125+
[src/dataset/DataSet.ts:190](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L190)
126126

127127
___
128128

@@ -134,7 +134,7 @@ All the possible kinds of nodes.
134134

135135
#### Defined in
136136

137-
[src/pattern/Nodes.ts:24](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/Nodes.ts#L24)
137+
[src/pattern/Nodes.ts:24](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/Nodes.ts#L24)
138138

139139
___
140140

@@ -161,7 +161,7 @@ replacement string.
161161

162162
#### Defined in
163163

164-
[src/censor/TextCensor.ts:99](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/TextCensor.ts#L99)
164+
[src/censor/TextCensor.ts:99](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/TextCensor.ts#L99)
165165

166166
## Variables
167167

@@ -222,7 +222,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
222222

223223
#### Defined in
224224

225-
[src/preset/english.ts:103](https://github.com/jo3-l/obscenity/blob/0b48eca/src/preset/english.ts#L103)
225+
[src/preset/english.ts:103](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/preset/english.ts#L103)
226226

227227
___
228228

@@ -235,7 +235,7 @@ A set of transformers to be used when matching blacklisted patterns with the
235235

236236
#### Defined in
237237

238-
[src/preset/english.ts:13](https://github.com/jo3-l/obscenity/blob/0b48eca/src/preset/english.ts#L13)
238+
[src/preset/english.ts:13](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/preset/english.ts#L13)
239239

240240
___
241241

@@ -248,7 +248,7 @@ dataset]] and the [[RegExpMatcher]].
248248

249249
#### Defined in
250250

251-
[src/preset/english.ts:48](https://github.com/jo3-l/obscenity/blob/0b48eca/src/preset/english.ts#L48)
251+
[src/preset/english.ts:48](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/preset/english.ts#L48)
252252

253253
___
254254

@@ -261,7 +261,7 @@ A set of transformers to be used when matching whitelisted terms with the
261261

262262
#### Defined in
263263

264-
[src/preset/english.ts:36](https://github.com/jo3-l/obscenity/blob/0b48eca/src/preset/english.ts#L36)
264+
[src/preset/english.ts:36](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/preset/english.ts#L36)
265265

266266
___
267267

@@ -273,7 +273,7 @@ The current version of the library, formatted as `MAJOR.MINOR.PATCH`.
273273

274274
#### Defined in
275275

276-
[src/index.ts:27](https://github.com/jo3-l/obscenity/blob/0b48eca/src/index.ts#L27)
276+
[src/index.ts:27](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/index.ts#L27)
277277

278278
## Functions
279279

@@ -312,7 +312,7 @@ to the [[RegExpMatcher]].
312312

313313
#### Defined in
314314

315-
[src/matcher/BlacklistedTerm.ts:37](https://github.com/jo3-l/obscenity/blob/0b48eca/src/matcher/BlacklistedTerm.ts#L37)
315+
[src/matcher/BlacklistedTerm.ts:37](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/matcher/BlacklistedTerm.ts#L37)
316316

317317
___
318318

@@ -339,7 +339,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
339339

340340
#### Defined in
341341

342-
[src/censor/BuiltinStrategies.ts:71](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L71)
342+
[src/censor/BuiltinStrategies.ts:71](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L71)
343343

344344
___
345345

@@ -402,7 +402,7 @@ A container holding the transformer, which can then be passed to the
402402

403403
#### Defined in
404404

405-
[src/transformer/collapse-duplicates/index.ts:46](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/collapse-duplicates/index.ts#L46)
405+
[src/transformer/collapse-duplicates/index.ts:46](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/collapse-duplicates/index.ts#L46)
406406

407407
___
408408

@@ -443,7 +443,7 @@ than the first.
443443

444444
#### Defined in
445445

446-
[src/matcher/MatchPayload.ts:57](https://github.com/jo3-l/obscenity/blob/0b48eca/src/matcher/MatchPayload.ts#L57)
446+
[src/matcher/MatchPayload.ts:57](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/matcher/MatchPayload.ts#L57)
447447

448448
___
449449

@@ -477,7 +477,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
477477

478478
#### Defined in
479479

480-
[src/censor/BuiltinStrategies.ts:134](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L134)
480+
[src/censor/BuiltinStrategies.ts:134](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L134)
481481

482482
___
483483

@@ -521,7 +521,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
521521

522522
#### Defined in
523523

524-
[src/censor/BuiltinStrategies.ts:115](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L115)
524+
[src/censor/BuiltinStrategies.ts:115](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L115)
525525

526526
___
527527

@@ -550,7 +550,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
550550

551551
#### Defined in
552552

553-
[src/censor/BuiltinStrategies.ts:89](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L89)
553+
[src/censor/BuiltinStrategies.ts:89](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L89)
554554

555555
___
556556

@@ -584,7 +584,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
584584

585585
#### Defined in
586586

587-
[src/censor/BuiltinStrategies.ts:51](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L51)
587+
[src/censor/BuiltinStrategies.ts:51](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L51)
588588

589589
___
590590

@@ -629,7 +629,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
629629

630630
#### Defined in
631631

632-
[src/censor/BuiltinStrategies.ts:28](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L28)
632+
[src/censor/BuiltinStrategies.ts:28](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L28)
633633

634634
___
635635

@@ -664,7 +664,7 @@ The parsed pattern, which can then be used with the
664664

665665
#### Defined in
666666

667-
[src/pattern/Pattern.ts:130](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/Pattern.ts#L130)
667+
[src/pattern/Pattern.ts:130](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/Pattern.ts#L130)
668668

669669
___
670670

@@ -797,7 +797,7 @@ The parsed pattern, which can then be used with the
797797

798798
#### Defined in
799799

800-
[src/pattern/Pattern.ts:106](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/Pattern.ts#L106)
800+
[src/pattern/Pattern.ts:106](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/Pattern.ts#L106)
801801

802802
___
803803

@@ -831,7 +831,7 @@ A [[TextCensorStrategy]] for use with the [[TextCensor]].
831831

832832
#### Defined in
833833

834-
[src/censor/BuiltinStrategies.ts:155](https://github.com/jo3-l/obscenity/blob/0b48eca/src/censor/BuiltinStrategies.ts#L155)
834+
[src/censor/BuiltinStrategies.ts:155](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/censor/BuiltinStrategies.ts#L155)
835835

836836
___
837837

@@ -891,7 +891,7 @@ A container holding the transformer, which can then be passed to the
891891

892892
#### Defined in
893893

894-
[src/transformer/remap-characters/index.ts:38](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/remap-characters/index.ts#L38)
894+
[src/transformer/remap-characters/index.ts:38](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/remap-characters/index.ts#L38)
895895

896896
___
897897

@@ -924,7 +924,7 @@ A container holding the transformer, which can then be passed to the
924924

925925
#### Defined in
926926

927-
[src/transformer/resolve-confusables/index.ts:22](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/resolve-confusables/index.ts#L22)
927+
[src/transformer/resolve-confusables/index.ts:22](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/resolve-confusables/index.ts#L22)
928928

929929
___
930930

@@ -958,7 +958,7 @@ A container holding the transformer, which can then be passed to the
958958

959959
#### Defined in
960960

961-
[src/transformer/resolve-leetspeak/index.ts:23](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/resolve-leetspeak/index.ts#L23)
961+
[src/transformer/resolve-leetspeak/index.ts:23](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/resolve-leetspeak/index.ts#L23)
962962

963963
___
964964

@@ -1000,7 +1000,7 @@ A container holding the transformer, which can then be passed to the
10001000

10011001
#### Defined in
10021002

1003-
[src/transformer/skip-non-alphabetic/index.ts:31](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/skip-non-alphabetic/index.ts#L31)
1003+
[src/transformer/skip-non-alphabetic/index.ts:31](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/skip-non-alphabetic/index.ts#L31)
10041004

10051005
___
10061006

@@ -1027,4 +1027,4 @@ A container holding the transformer, which can then be passed to the
10271027

10281028
#### Defined in
10291029

1030-
[src/transformer/to-ascii-lowercase/index.ts:18](https://github.com/jo3-l/obscenity/blob/0b48eca/src/transformer/to-ascii-lowercase/index.ts#L18)
1030+
[src/transformer/to-ascii-lowercase/index.ts:18](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/transformer/to-ascii-lowercase/index.ts#L18)

docs/reference/classes/DataSet.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const customDataset = new DataSet().addAll(englishDataset);
6363

6464
#### Defined in
6565

66-
[src/dataset/DataSet.ts:29](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L29)
66+
[src/dataset/DataSet.ts:29](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L29)
6767

6868
___
6969

@@ -96,7 +96,7 @@ const data = new DataSet<{ originalWord: string }>()
9696

9797
#### Defined in
9898

99-
[src/dataset/DataSet.ts:75](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L75)
99+
[src/dataset/DataSet.ts:75](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L75)
100100

101101
___
102102

@@ -122,7 +122,7 @@ const matcher = new RegExpMatcher({
122122

123123
#### Defined in
124124

125-
[src/dataset/DataSet.ts:118](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L118)
125+
[src/dataset/DataSet.ts:118](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L118)
126126

127127
___
128128

@@ -154,7 +154,7 @@ const phraseMetadata = matchesWithPhraseMetadata[0].phraseMetadata;
154154

155155
#### Defined in
156156

157-
[src/dataset/DataSet.ts:94](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L94)
157+
[src/dataset/DataSet.ts:94](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L94)
158158

159159
___
160160

@@ -184,4 +184,4 @@ const customDataset = new DataSet<{ originalWord: string }>()
184184

185185
#### Defined in
186186

187-
[src/dataset/DataSet.ts:46](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L46)
187+
[src/dataset/DataSet.ts:46](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L46)

docs/reference/classes/ParserError.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Error.constructor
4444

4545
#### Defined in
4646

47-
[src/pattern/ParserError.ts:18](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/ParserError.ts#L18)
47+
[src/pattern/ParserError.ts:18](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/ParserError.ts#L18)
4848

4949
## Properties
5050

@@ -57,7 +57,7 @@ Note that surrogate pairs are counted as 1 column wide, not 2.
5757

5858
#### Defined in
5959

60-
[src/pattern/ParserError.ts:16](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/ParserError.ts#L16)
60+
[src/pattern/ParserError.ts:16](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/ParserError.ts#L16)
6161

6262
___
6363

@@ -69,7 +69,7 @@ The line on which the error occurred (one-based).
6969

7070
#### Defined in
7171

72-
[src/pattern/ParserError.ts:10](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/ParserError.ts#L10)
72+
[src/pattern/ParserError.ts:10](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/ParserError.ts#L10)
7373

7474
___
7575

@@ -97,7 +97,7 @@ Error.name
9797

9898
#### Defined in
9999

100-
[src/pattern/ParserError.ts:5](https://github.com/jo3-l/obscenity/blob/0b48eca/src/pattern/ParserError.ts#L5)
100+
[src/pattern/ParserError.ts:5](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/pattern/ParserError.ts#L5)
101101

102102
___
103103

docs/reference/classes/PhraseBuilder.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Associates a pattern with this phrase.
5555

5656
#### Defined in
5757

58-
[src/dataset/DataSet.ts:149](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L149)
58+
[src/dataset/DataSet.ts:149](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L149)
5959

6060
___
6161

@@ -77,7 +77,7 @@ Associates a whitelisted pattern with this phrase.
7777

7878
#### Defined in
7979

80-
[src/dataset/DataSet.ts:159](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L159)
80+
[src/dataset/DataSet.ts:159](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L159)
8181

8282
___
8383

@@ -94,7 +94,7 @@ Builds the phrase, returning a [[PhraseContainer]] for use with the
9494

9595
#### Defined in
9696

97-
[src/dataset/DataSet.ts:178](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L178)
97+
[src/dataset/DataSet.ts:178](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L178)
9898

9999
___
100100

@@ -116,4 +116,4 @@ Associates some metadata with this phrase.
116116

117117
#### Defined in
118118

119-
[src/dataset/DataSet.ts:169](https://github.com/jo3-l/obscenity/blob/0b48eca/src/dataset/DataSet.ts#L169)
119+
[src/dataset/DataSet.ts:169](https://github.com/jo3-l/obscenity/blob/5bb1ef1/src/dataset/DataSet.ts#L169)

0 commit comments

Comments
 (0)