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

validai

v1.0.0

Published

AI-powered text validation for slang and gibberish detection

Readme

ValidAI

ValidAI is a powerful text validation library that uses AI to detect offensive and gibberish content in text. It's perfect for content moderation, form validation, and ensuring high-quality user-generated content. Now you don't have to worry about random content being posted on to your platform by the users. or spend days writing validation rules for your Input fields.

Features

  • Detect offensive words in any language
  • Identify gibberish or spam content
  • Support for multiple AI providers (currently Gemini, with plans for OpenAI and Anthropic)
  • TypeScript support
  • Detailed validation results with explanations
  • Easy to use API

Installation

npm install validai

Usage

import { ValidAI } from 'validai';

// Initialize with your API key
const validator = new ValidAI(
    process.env.GEMINI_API_KEY,
    "gemini",
    "gemini-2.0-flash"
);

// Example usage
const userInput = {
    title: "Hello World!",
    description: "This is a test description",
    morecontent: "This is a test content fuck",
    morecontent2: "This is random gibrish fwhqfqwiofhwqhfqwoifhwq",
};

try {
    const result = await validator.validate(userInput);
    console.log(result);
    /*
    {
        success: false,
        results: {
            title: {
                restricted: false,
                restrictedReason: "",
                gibbrish: false,
                gibbrishReason: ""
            },
            description: {
                restricted: false,
                restrictedReason: "",
                gibbrish: false,
                gibbrishReason: ""
            },
            morecontent: {  
                restricted: true,
                restrictedReason: "Contains offensive words: 'fuck'",
                gibbrish: false,
                gibbrishReason: ""
            },
            morecontent2: {
                restricted: false   ,
                restrictedReason: "",
                gibbrish: true,
                gibbrishReason: "Contains gibberish: 'fwhqfqwiofhwqhfqwoifhwq'"
            }
        }
    }
    */
} catch (error) {
    console.error('Validation error:', error);
}

API Reference

ValidAI

Main class for text validation.

Constructor

constructor(apiKey: string, provider: Provider, model: string)
  • apiKey: Your API key for the chosen provider
  • provider: Currently only supports "gemini"
  • model: Model name for the chosen provider

Methods

validate(input: Record<string, any>): Promise<ValidationResponse>

Validates the provided text input for offensive and gibberish content.

  • input: Record of field names to text content
  • Returns: Promise containing validation results and overall success status

Types

ValidationResponse

interface ValidationResponse {
    success: boolean;
    results: Record<string, ValidationResult>;
}

ValidationResult

interface ValidationResult {
    restricted: boolean;
    restrictedReason: string;
    gibbrish: boolean;
    gibbrishReason: string;
}

Environment Variables

Create a .env file in your project root:

GEMINI_API_KEY=your_api_key_here

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.