Redact

Redact

  • Docs
  • Help
  • Blog

›Guides

Getting Started

  • Installing Redact
  • Updating Redact

Guides

  • Blacklist
  • Whitelist
  • Redact
  • Blacklist Check
  • Blacklist Count

Utils

  • Available lists

Check sentences for blacklisted word

You can check if a given string/sentence has a blacklisted word in it.

Syntax

isBlacklisted(string: string, ...args: string[]): boolean

Parameters

string: string - Given string/sentence to be checked.

blacklist: string[] - Blacklist

Returns

boolean - Returns true if it has a blacklisted word, otherwise false.

Error

Throws an error if the required parameters are not given to the function.

Import

import { isBlacklisted } from '@princedev/redact';

Examples

Basic usage with a blacklisted word.

const racialBlacklist = blacklist('nigga', 'eskimo');
const result = isBlacklisted('Wassup my nigga', racialBlacklist);

result would be true.

Basic usage with no blacklisted word.

const racialBlacklist = blacklist('nigga', 'eskimo');
const result = isBlacklisted('Wassup my friend', racialBlacklist);

result would be false.

Last updated on 7/22/2020 by Prince Neil Cedrick Castro
← RedactBlacklist Count →
  • Syntax
    • Parameters
    • Returns
    • Error
  • Import
  • Examples
Redact
Docs
Getting StartedGuides
Package
NPMGitHubStar
More
HelpBlog
aws.cedi@gmail.com
Copyright © 2020 Redact