PurifySentence is a lightweight npm package designed to filter out sensitive words from a given sentence. It provides a simple yet effective solution to sanitize text inputs, ensuring that sensitive or inappropriate language is removed before further processing or display.
You can install PurifySentence via npm:
npm install purifysentence
To use PurifySentence, simply import the purifysentence
function and call it with the sentence you want to purify and an array of words to filter out.
import { purifysentence } from "purifysentence";
const sentence = "I don't like bad words in my main sentences.";
const sensitiveWords = ["bad", "main"];
const purifiedSentence = purifysentence({ sentence, words: sensitiveWords });
console.log(purifiedSentence);
// Output: "I don't like ***** words in my ***** sentences."
import { purifysentence } from "purifysentence";
const sentence = "I can't believe he said those awful things!";
const sensitiveWords = ["awful"];
const purifiedSentence = purifysentence({ sentence, words: sensitiveWords });
console.log(purifiedSentence);
// Output: "I can't believe he said those ***** things!"
Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.