New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@2toad/profanity

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@2toad/profanity - npm Package Compare versions

Comparing version 3.0.1 to 3.1.1

39

contribute.md

@@ -72,2 +72,35 @@ # Contribute to the Profanity project 🤝

### Translations
We utilize a self-hosted instance of the Open Source [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) lib to translate the core English list of profane words.
#### Steps to Run Translations
1. Open a terminal.
2. Generate translations: `npm run translate`.
#### Available Languages
By default, the LibreTranslate service is configured to include all available target languages from [argos-translate](https://github.com/argosopentech/argos-translate). This configuration affects:
- **Startup Time**: Initial service startup. Depending on your system, this can take ~5 minutes.
- **Translation Time**: Translating across all languages increases processing time.
- **Library Size**: The final size of the Profanity library.
To optimize performance, we limit the target languages by configuring the `LT_LOAD_ONLY` environment variable:
##### Configure Target Languages
1. Open the [docker-compose.yml](./src/tools/translate/docker-compose.yml) file.
2. Add a comma-separated list of the [supported language codes](https://github.com/argosopentech/argos-translate/blob/master/argostranslate/languages.csv) you wish to include. Ensure English (`en`) is included, as it serves as the source language.
**Example Configuration:**
```yaml
environment:
LT_LOAD_ONLY: "en,es,fr,de"
```
> **Note:**
> - To add a new language, remove existing language codes from `LT_LOAD_ONLY`
> - To update existing languages after changes to the core English list, include their language codes in `LT_LOAD_ONLY`
### Deployment

@@ -82,5 +115,7 @@

1. Run the script: `npm run benchmark`.
2. Record the results in [benchmark/results.md](./src/benchmark/results.md), for the new version.
2. Record the results in [benchmark/results.md](./src/tools/benchmark/results.md), for the new version.
4. Rebuild package-lock, to pick up the new version number: `npm i --package-lock-only`.
5. Push changes:
5. Create local NPM package: `npm pack`
- Examine generated tar file to ensure it looks healthy
6. Push changes:
```

@@ -87,0 +122,0 @@ git add .

8

package.json
{
"name": "@2toad/profanity",
"version": "3.0.1",
"version": "3.1.1",
"description": "A multi-language profanity filter with full TypeScript support",

@@ -20,3 +20,2 @@ "homepage": "https://github.com/2Toad/Profanity",

"test:watch": "npm run test -- --watch",
"benchmark": "docker-compose -f ./src/benchmark/docker-compose.yml up --build",
"lint": "eslint . --cache",

@@ -26,3 +25,5 @@ "lint:fix": "eslint . --fix",

"prepublishOnly": "npm run lint && npm test",
"prepare": "husky"
"prepare": "husky",
"translate": "docker-compose -f ./src/tools/translate/docker-compose.yml up -d && ts-node ./src/tools/translate/translate.ts && docker-compose -f ./src/tools/translate/docker-compose.yml down",
"benchmark": "docker-compose -f ./src/tools/benchmark/docker-compose.yml up --build"
},

@@ -65,2 +66,3 @@ "repository": {

"@typescript-eslint/parser": "^8.4.0",
"axios": "^1.7.9",
"benchmark": "^2.1.4",

@@ -67,0 +69,0 @@ "chai": "^4.5.0",

@@ -61,3 +61,3 @@ # Profanity 🧼

const profanity = new Profanity({
languages: ["en", "de"],
languages: ['en', 'de'],
});

@@ -69,6 +69,6 @@ ```

```JavaScript
profanity.exists('Je suis un connard', ["fr"]);
profanity.exists('Je suis un connard', ['fr']);
// true
profanity.censor('I like big butts and je suis un connard', CensorType.Word, ["en", "de", "fr"]);
profanity.censor('I like big butts and je suis un connard', CensorType.Word, ['en', 'de', 'fr']);
// I like big @#$%&! and je suis un @#$%&!

@@ -169,3 +169,3 @@ ```

To see how Profanity performs, check out our [benchmark results](./src/benchmark/results.md).
To see how Profanity performs, check out our [benchmark results](./src/tools/benchmark/results.md).

@@ -172,0 +172,0 @@ ## Contributing 🤝

# Profanity Supported Languages
| **Language** | **Locale** |
|--------------|------------|
| German | `de` |
| English | `en` |
| Spanish | `es` |
| French | `fr` |
There are many more [languages](https://github.com/argosopentech/argos-translate/blob/master/argostranslate/languages.csv) that Profanity _can_ support, however each additional language incorporated into the Profanity library increases the overall size of the library. To maintain performance and usability, we've limited translations to the following languages:
| **Language** | **Locale** |
|-----------------------|------------|
| Arabic | `ar` |
| Chinese | `zh` |
| English | `en` |
| French | `fr` |
| German | `de` |
| Hindi | `hi` |
| Japanese | `ja` |
| Korean | `ko` |
| Portuguese | `pt` |
| Russian | `ru` |
| Spanish | `es` |
If you'd like to request a language not currently supported by Profanity, please submit your suggestion via our [GitHub issues page](https://github.com/2Toad/Profanity/issues). Keep in mind that Profanity's architecture already supports all languages through its [Customize Wordlist](https://github.com/2Toad/Profanity?tab=readme-ov-file#customize-the-word-list) feature, allowing you to add as many words or translations as you like during runtime.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc