You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,17 @@
6
6
7
7
A JavaScript profanity filter (with TypeScript support)
8
8
9
-
## Getting Started 🚀
9
+
## Getting Started
10
10
11
11
Install the package
12
12
13
13
```Shell
14
14
npm i @2toad/profanity
15
15
```
16
16
17
-
>If you're using Node 11.x or older, you'll need to install [Profanity 1.x](https://github.com/2Toad/Profanity/releases) (e.g., `npm i @2toad/profanity@1.4.1`)
17
+
>If you're using Node 11.x or older, you'll need to install [Profanity 1.x](https://github.com/2Toad/Profanity/releases)
@@ -38,7 +38,7 @@ profanity.censor('I like big butts (aka arses) and I cannot lie', CensorType.Fir
38
38
// I like big *utts (aka *rses) and I cannot lie
39
39
```
40
40
41
-
## Options ⚙️
41
+
## Options
42
42
Create an instance of the Profanity class to change the default options:
43
43
44
44
```JavaScript
@@ -51,7 +51,7 @@ const profanity = new Profanity({
51
51
});
52
52
```
53
53
54
-
### wholeWord 🔤
54
+
### wholeWord
55
55
56
56
By default, this is set to `true` so profanity only matches on whole words:
57
57
```JavaScript
@@ -82,7 +82,7 @@ profanity.exists("Don't be an arsenic-monster");
82
82
// true (matched on arse)
83
83
```
84
84
85
-
### grawlix 💥
85
+
### grawlix
86
86
87
87
By default this is set to `@#$%&!`:
88
88
```JavaScript
@@ -96,7 +96,7 @@ profanity.censor('I like big butts and I cannot lie');
96
96
// I like big **** and I cannot lie
97
97
```
98
98
99
-
### grawlixChar 💲
99
+
### grawlixChar
100
100
101
101
When specifying a `CensorType` other than `CensorType.Word`, this is the character used by the `censor` function.
102
102
@@ -113,7 +113,7 @@ profanity.censor('I like big butts and I cannot lie', CensorType.AllVowels);
113
113
```
114
114
115
115
116
-
## Customize the word list 📝
116
+
## Customize the word list
117
117
118
118
Add words:
119
119
```JavaScript
@@ -125,7 +125,7 @@ Remove words:
125
125
profanity.removeWords(['butt', 'arse']);
126
126
```
127
127
128
-
## Whitelist ✅
128
+
## Whitelist
129
129
The whitelist allows you to specify words that are always ignored by the profanity filter.
130
130
131
131
>This can be useful if you want to enable partial word matching (`wholeWord = false`), so combined words are caught (e.g., arselicker), while specific words you add to the whitelist are ignored (e.g., arsenic).
@@ -140,6 +140,10 @@ Remove words from the whitelist:
Copy file name to clipboardExpand all lines: contribute.md
+26-23Lines changed: 26 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Thank you for wanting to contribute to the Profanity project. With your contributions we can ensure Profanity remains a leading solution for filtering profanity within JavaScript projects
1. Always work off of an Issue. Please do not submit a Pull Request that is not associated with an Issue (create the Issue if necessary).
@@ -19,35 +19,35 @@ Thank you for wanting to contribute to the Profanity project. With your contribu
19
19
2. Make sure your PR is targeting the correct branch (see Step 2.ii)
20
20
3. At the top of your PR description write: "Fixes #_n_". Where _n_ is the number of the Issue your PR is fixing (e.g., `Fixes #33`). This will tell GitHub to associate your PR with the Issue.
> When file changes are detected, the app will automatically rebuild/restart
40
40
41
-
#### Linting 🧹
41
+
#### Linting
42
42
43
43
- Check lint rules: `npm run lint`
44
44
- Fix lint errors: `npm run lint:fix`
45
45
- Check formatting rules: `npm run prettier`
46
46
- Fix formatting errors: `npm run prettier:fix`
47
47
48
-
## Appendix 📚
48
+
## Appendix
49
49
50
-
### Dev Tools 🛠️
50
+
### Dev Tools
51
51
52
52
The following section includes optional dev tools that enhance the Profanity development experience, but are not necessary.
53
53
@@ -67,38 +67,41 @@ The Profanity project includes an .nvmrc file, so you can run `nvm use` to switc
67
67
68
68
The Profanity project includes Husky for running Git Hooks. Running `git commit` will trigger `lint-staged` which will lint all files currently staged in Git. If linting fails, the commit will be cancelled
69
69
70
-
### Dependencies 📦
70
+
### Dependencies
71
71
72
72
-`chai`: we must use v4.x because v5.x is pure ESM, and we require CommonJS modules
73
73
74
-
### Deployments 🚀
74
+
### Deployment
75
75
76
-
Deployments to Prod consist of building and publishing the Profanity lib to NPM, and are automated through our Continous Deployment workflow.
76
+
Deploying to Prod consist of building and publishing the Profanity lib to NPM, and are automated through our Continuous Deployment workflow.
77
77
78
-
#### 1. Change Version
79
-
1. Checkout `master`
80
-
2. Increment version (semantic) in package.json (e.g., 1.1.0)
81
-
3. Rebuild package-lock (to pick up new version ): `npm i --package-lock-only`
82
-
4. Push changes:
78
+
#### 1. Create New Version
79
+
1. Checkout `master`.
80
+
2. Increment the version in package.json, using semantic versioning (e.g., `1.1.0`).
81
+
3. Perform benchmarking:
82
+
1. Run the script: `npm run benchmark`.
83
+
2. Record the results in [benchmark/results.md](./src/benchmark/results.md), for the new version.
84
+
4. Rebuild package-lock, to pick up the new version number: `npm i --package-lock-only`.
85
+
5. Push changes:
83
86
```
84
87
git add .
85
-
git commmit -m "Bump version to 1.1.0"
88
+
git commit -m "Bump version to 1.1.0"
86
89
git push
87
90
```
88
91
89
92
#### 2. Verify Checks
90
-
1. Navigate to the [CI](https://github.com/2Toad/Profanity/actions/workflows/ci.yml) workflow
91
-
2. Ensure the run for the above "Bump version" commit succeeds
93
+
1. Navigate to the [CI](https://github.com/2Toad/Profanity/actions/workflows/ci.yml) workflow.
94
+
2. Ensure the build checks for this push succeed.
92
95
93
96
#### 3. Publish GitHub Release
94
-
1. Navigate to [Profanity's releases](https://github.com/2Toad/Profanity/releases)
95
-
2. Click "Draft a new release"
97
+
1. Navigate to [Profanity's releases](https://github.com/2Toad/Profanity/releases).
98
+
2. Click "Draft a new release":
96
99
-**Choose a tag**: enter version (e.g., `v1.1.0`) and click "Create new tag"
97
100
-**Target**: `master`
98
101
-**Previous tag**: `auto`
99
102
-**Release title**: (e.g., `1.1.0`)
100
-
-**Description**: click the "Genereate release notes"
103
+
-**Description**: click the "Generate release notes"
101
104
-[x]**Set as the latest release**
102
-
3. Click "Publish release"
105
+
3. Click "Publish release".
103
106
104
107
> This will trigger the [CDP](https://github.com/2Toad/Profanity/actions/workflows/cdp.yml) workflow, which will build and deploy the package to NPM: https://www.npmjs.com/package/@2toad/profanity
0 commit comments