npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nepali-profanity-filter

v1.0.1

Published

A comprehensive profanity filter for Nepali language supporting both English and Devanagari script

Readme

Nepali Profanity Filter

A comprehensive profanity filter for Nepali language supporting both Romanized Nepali and Devanagari script.

Installation

npm install nepali-profanity-filter

or

yarn add nepali-profanity-filter

Features

  • ✅ Supports Romanized Nepali (e.g., "khate", "kukur")
  • ✅ Supports Devanagari script (e.g., "खाटे", "कुकुर")
  • ✅ Case-insensitive filtering
  • ✅ Leetspeak detection (e.g., "khate", "r@ndi")
  • ✅ Custom word lists
  • ✅ TypeScript support
  • ✅ Works in Node.js and browsers
  • ✅ Zero dependencies

Usage

Basic Usage

import NepaliProfanityFilter from 'nepali-profanity-filter';

const filter = new NepaliProfanityFilter();

// Check if text contains profanity
filter.isProfane('hello muji'); // true
filter.isProfane('hello world'); // false

// Clean text
filter.clean('hello muji world'); // "hello \*\*\* world"

// Get detailed results
const result = filter.filter('hello muji world');
console.log(result);
// {
// clean: "hello \*\*\* world",
// isProfane: true,
// matches: ["muji"],
// originalText: "hello muji world"
// }

TypeScript

import NepaliProfanityFilter, { FilterOptions, FilterResult } from 'nepali-profanity-filter';

const options: FilterOptions = {
replaceWith: '[censored]',
customWords: ['badword'],
caseSensitive: false,
matchWholeWord: true,
};

const filter = new NepaliProfanityFilter(options);

const result: FilterResult = filter.filter('some text');

Custom Replacement

const filter = new NepaliProfanityFilter({
replaceWith: '[censored]'
});

filter.clean('hello muji'); // "hello [censored]"

Custom Words

const filter = new NepaliProfanityFilter({
customWords: ['custom1', 'custom2']
});

// Add more words dynamically
filter.addWords(['newbadword']);

// Remove words
filter.removeWords(['muji']);

Case Sensitive

const filter = new NepaliProfanityFilter({
caseSensitive: true
});

filter.isProfane('muji'); // true
filter.isProfane('MUJI'); // false

Partial Matching

const filter = new NepaliProfanityFilter({
matchWholeWord: false
});

filter.isProfane('mujification'); // true

API

Constructor

new NepaliProfanityFilter(options?: FilterOptions)

Options

| Option | Type | Default | Description | | ------------------ | -------- | ------------ | -------------------------------- | | replaceWith | string | "\*\*\*" | Replacement string for profanity | | customWords | string[] | [] | Additional words to filter | | caseSensitive | boolean | false | Enable case-sensitive matching | | matchWholeWord | boolean | true | Only match whole words |

Methods

isProfane(text: string): boolean

Check if text contains profanity.

clean(text: string): string

Remove profanity from text.

filter(text: string): FilterResult

Get detailed filter results including matches.

addWords(words: string[]): void

Add custom words to filter list.

removeWords(words: string[]): void

Remove words from filter list.

getWords(): string[]

Get all words in filter list.

Use Cases

Content Moderation

app.post('/comment', (req, res) => {
const { text } = req.body;

if (filter.isProfane(text)) {
return res.status(400).json({
error: 'Comment contains inappropriate language'
});
}

// Save comment...
});

Auto-cleaning

app.post('/post', (req, res) => {
const { text } = req.body;
const cleanText = filter.clean(text);

// Save cleanText...
});

React Hook

import { useState } from 'react';
import NepaliProfanityFilter from 'nepali-profanity-filter';

const filter = new NepaliProfanityFilter();

function CommentForm() {
const [text, setText] = useState('');
const [error, setError] = useState('');

const handleSubmit = () => {
if (filter.isProfane(text)) {
setError('Please remove inappropriate language');
return;
}
// Submit...
};

return (
<form onSubmit={handleSubmit}>
    <textarea value={text} onChange={(e) => setText(e.target.value)} />
    {error && <p>{error}</p>}
    <button type="submit">Submit</button>
</form>
);
}

Contributing

We welcome contributions! To add more Nepali profanity words:

  1. Fork the repository
  2. Edit src/words.ts
  3. Add tests in tests/filter.test.ts
  4. Submit a pull request

Privacy & Ethics

This package is designed to help maintain respectful online communities. The word list is curated to filter common Nepali profanity while minimizing false positives.

License

Support