A node.js library that returns naughty strings from an offline database of Big List of Naughty Strings and emojis.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
src
test
.eslintrc
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
LICENSE
README.md
package.json

README.md

naughty-string-validator

Build Status Coverage Status npm version npm dependencies Status devDependencies Status Known Vulnerabilities License: MIT Inline docs

A node.js library that returns naughty strings from an offline database of Big List of Naughty Strings and emojis. The db will be continuously growing with each release.

The Big List of Naughty Strings is an evolving list of strings which have a high probability of causing issues when used as user-input data.

This library can be inluded in the test automation framework for API, UI, or DB testing to validate them against naughty strings.

Installation

npm install naughty-string-validator

Usage

var naughty = require('naughty-string-validator');
  • To get a random naughty string from the list

    var randomNaughty = naughty.getRandomNaughtyString();
    
    //randomNaughty
    "<a href=\"\\xE2\\x80\\x88javascript…(1)\" id=\"fuzzelement1\">test</a>"
  • To get entire naughty string list

    var naughtyList = naughty.getNaughtyStringList();
    
    //naughtyList
    ["", "undefined", "undef", "null", "NULL", "(null)", "nil", …]
  • To get a random emoji from the emoji list

    var randomEmoji = naughty.getRandomEmoji();
    
    //randomEmoji
     "😃"
  • To get a entire emoji list

    var emojiList = naughty.getEmojiList();
    
    //emojiList
    ["😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "☺️", "😊", …]
  • To get emoji list of a particular category:

    'People', 'Nature', 'Foods', 'Activity', 'Places', 'Objects', 'Symbols', 'Flags'

    var emojiList = naughty.getEmojiList('Flags');
    
    //emojiList
    ['🏳️', '🏴', '🏁', '🚩', '🏳️‍🌈', '🇦🇫', '🇦🇽','🇦🇱', …]
    
    //if the emoji category doesn't exist, you will get the entire emoji list

## Tests
```shell
//To run test with linting
npm test

//Test with coverage
npm run cover

☑ Roadmap

  • Add Support to return naughtified json data from json schema
  • Add Support for emoji
  • Add Support to get a desired emoji by name
  • Add Support to get NaughtyStringList of a given length
  • Add Support for mocha and chai integration
  • Add Support to get list of stickers

If you think you can contribute to any of the roadmap or suggest something new, you can contribute to this project by opening a pull request.