How to use bad-words - 8 common examples

To help you get started, we’ve selected a few bad-words examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RocketChat / Rocket.Chat / app / lib / server / methods / filterBadWords.js View on Github external
callbacks.add('beforeSaveMessage', function(message) {
	if (settings.get('Message_AllowBadWordsFilter')) {
		const badWordsList = settings.get('Message_BadWordsFilterList');
		let options;

		// Add words to the blacklist
		if (!!badWordsList && badWordsList.length) {
			options = {
				list: badWordsList.split(','),
			};
		}
		const filter = new Filter(options);
		message.msg = filter.clean(message.msg);
	}

	return message;
}, 1, 'filterBadWords');
github RocketChat / Rocket.Chat / packages / rocketchat-lib / server / methods / filterBadWords.js View on Github external
RocketChat.callbacks.add('beforeSaveMessage', function(message) {

	if (RocketChat.settings.get('Message_AllowBadWordsFilter')) {
		const badWordsList = RocketChat.settings.get('Message_BadWordsFilterList');
		let options;

		// Add words to the blacklist
		if (!!badWordsList && badWordsList.length) {
			options = {
				list: badWordsList.split(','),
			};
		}
		const filter = new Filter(options);
		message.msg = filter.clean(message.msg);
	}

	return message;

}, 1, 'filterBadWords');
github dtinth / ysetter-hackathon-commit-board / src / AppView.js View on Github external
import React, { Component } from 'react'

import Filter from 'bad-words'
import { emojify } from 'react-emojione'
import logo from './logo.svg'

const filter = new Filter({ placeHolder: '😄' })

export default function({ data }) {
  const Visualizer = require('./Visualizer').default
  const Countdown = require('./Countdown').default
  const commits = []
    .concat(...data)
    .map(x => {
      let time = +new Date(x.commit.committer.date)
      if (time > Date.now() + 3600e3) {
        time -= 3600e3 * 7
      }
      return { ...x, time }
    })
    .sort((a, b) => {
      if (a.time < b.time) return 1
      return -1
github dtinth / ysetter-hackathon-commit-board / src / App.js View on Github external
import React, { Component } from 'react'

import Filter from 'bad-words'

const filter = new Filter({ placeHolder: '😄' })

const teams = [
  ['https://github.com/Teerapat12/Sansiri_Hackathon_Waifu'],
  ['https://github.com/UKRx/hackthon2'],
  ['https://github.com/nattaaek/goodspace'],
  ['https://github.com/blacksourcez/BigTU2'],
  ['https://github.com/phiyawat/good-space'],
  ['https://github.com/kennaruk/YsetterHackathon'],
  ['https://github.com/Kokoskun/YR2'],
  [
    'https://github.com/tidjungs/goodspace-frontend',
    'https://github.com/monthol8th/goodspace-backend'
  ],
  ['https://github.com/Mingmon/ysetter-hackathon-2']
]
github OpenZeppelin / gsn-sample-chat_app / client / src / components / Chatcontainer / ChatWindow / index.js View on Github external
const ChatWindow = props => {
  const { messages } = props;
  const filter = new Filter();
  const listMsg = messages.slice(0, 20).map(msg => {
    msg.message = filter.clean(msg.message);
    return (
      <div>
        <div>
          {msg.mined ?
                    </div></div>
github RisingStack / graffiti-todo / server.js View on Github external
import Inert from 'inert';
import { hapi } from '@risingstack/graffiti';
import { getSchema } from '@risingstack/graffiti-mongoose';
import mongoose from 'mongoose';
import mongooseSchema from './data/schema';
import Filter from 'bad-words';

const PORT = process.env.PORT || 8080;
const MONGO_URI = process.env.MONGO_URI || process.env.MONGOLAB_URI || 'mongodb://localhost/graphql';

mongoose.connect(MONGO_URI);

const server = new Hapi.Server();
server.connection({ port: PORT });

const filter = new Filter();
const hooks = {
  mutation: {
    pre: (next, todo, ...rest) => {
      if (todo.text) {
        todo.text = filter.clean(todo.text);
      }

      next(todo, ...rest);
    }
  }
};
server.register([Inert, {
  register: hapi,
  options: {
    schema: getSchema(mongooseSchema, { hooks })
  }
github react-in-action / letters-social / src / components / post / Create.js View on Github external
constructor(props) {
        super(props);
        this.initialState = {
            content: '',
            valid: false,
            showLocationPicker: false,
            location: {
                lat: 34.1535641,
                lng: -118.1428115,
                name: null
            },
            locationSelected: false
        };
        this.state = this.initialState;
        this.filter = new Filter();
        this.handlePostChange = this.handlePostChange.bind(this);
        this.handleRemoveLocation = this.handleRemoveLocation.bind(this);
        this.handleSubmit = this.handleSubmit.bind(this);
        this.handleToggleLocation = this.handleToggleLocation.bind(this);
        this.onLocationSelect = this.onLocationSelect.bind(this);
        this.onLocationUpdate = this.onLocationUpdate.bind(this);
        this.renderLocationControls = this.renderLocationControls.bind(this);
    }
    handlePostChange(event) {
github FiberJW / pul / utils / filter.js View on Github external
import Filter from "bad-words";

const filter = new Filter();
filter.addWords([
  "vagina",
  "vape",
  "juwan",
  "wheatley",
  "juan",
  "jaun",
  "jau'n"
]);

export default filter;

bad-words

A javascript filter for bad words

MIT
Latest version published 3 months ago

Package Health Score

72 / 100
Full package analysis

Popular bad-words functions