JSPM

react-mute

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q26952F
  • License MIT

Mute the bad words in react component

Package Exports

  • react-mute

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-mute) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react mute

Mute the bad words in react component

Introduction

Stop people from polluting your react application with bad words. Mute the bad words.

This library uses react fragment and thus does not add any DOM node.

Installing

  $ yarn add react-mute

Usage

  import Mute from 'react-mute';

  // in render
  <Mute
    safeText="❤️"
    addWords=["bad"]
  >{"Actual text there bad words are to be muted"}
  </Mute>

  // => Actual text there ❤️❤️❤️ words are to be muted

API

children

type: string

Text that needs to be muted

addWords

type: Array

Array of words to mute. These will append to the list of existing list of bad words.

List of words → https://github.com/web-mech/badwords/blob/master/lib/lang.json

removeWords

type: Array

Array of words to unmute. This will remove words from existing list of bad words.

safeText

default: '*'

type: string

Replace these character in muted words.

*** This package is dependent on https://github.com/web-mech/badwords for badwords implementation ***

License

MIT Copyright (c) 2018-present Ajay Narain Mathur