UNPKG

paknevis

Version:

Paknevis.js is a persian text formatter tool.

68 lines (48 loc) 1.77 kB
# 📃 paknevis.js Paknevis.js is a npm package to detect or censor persian swears and bad words. Suitable for use in chat programs, comment sections, and entries where you want to be free of inappropriate text content. ## 🛠️ Examples You can use it in both CommonJS and ESM modules: ```js import { Paknevis } from "paknevis"; ``` Or ```js const { Paknevis } = require("paknevis"); ``` Also you can use it in most modern browsers: ```html <script type="module"> import { Paknevis } from 'public/js/paknevis/esm/paknevis.js'; ... </script> ``` > **Basic usage:** You can find this file in [`examples/example.js`](https://github.com/kaveh-dev/paknevis.js/blob/main/examples/example.js) . ```js const { Paknevis } = require('paknevis'); const text = "این یک فحش است : تخمی"; Paknevis.hasBadWords(text); // returns true. Paknevis.censor(text); // returns "این یک فحش است" ``` > **With extra words:** ```js const { Paknevis } = require('paknevis'); const text = "این یک فحش است : بازاری"; Paknevis.hasBadWords(text, ["بازاری"]); // returns true. Paknevis.censor(text, ["بازاری"]); // returns "این یک فحش است" ``` > **With censor character:** ```js const { Paknevis } = require('paknevis.js'); const text = "این یک فحش است : تخمی"; Paknevis.hasBadWords(text); // returns true. Paknevis.censor(text, "*"); // returns "* این یک فحش است" ``` ## 🚀 Testing You can test code's functionality by `jest` package in Node.js. ```cli npm run test ``` ## 🤝 Contribution and development of code Feel free to open an issue and contribute to the code, and if you like the code, give it a star!