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

@s3dking/randomjoke

v2.0.0

Published

Choose a random dad joke

Readme

@s3dking/randomjoke

@s3dking/randomjoke is a versatile package for generating and managing various types of jokes, including dad jokes, dark humor, programming jokes, and puns. Version 2.0.0 introduces rating systems, joke tags, and caching for better performance.

Features

  • Multiple Joke Categories: Dad jokes, dark humor, programming jokes, and puns
  • Rating System: Rate jokes and get top-rated content
  • Tag-Based Filtering: Find jokes by tags
  • Caching System: Improved performance for repeated requests
  • Multi-Language Support: Basic support for different languages
  • Custom Jokes: Add your own jokes with ratings and tags
  • CLI Support: Complete command-line interface

Installation

# Local installation
npm install @s3dking/randomjoke

# Global installation (for CLI usage)
npm install -g @s3dking/randomjoke

CLI Usage

Get Jokes

# Basic usage
randomjoke get
randomjoke get -t dark -a 3 -n

# Positional arguments
randomjoke dad 2 true

Rate Jokes

randomjoke rate -t dad -i 0 -r 5

Submit New Jokes

randomjoke submit -t dad -x "Your joke here" -g "funny,wordplay"

Get Top Rated Jokes

randomjoke top -t dark -l 5

JavaScript Usage

Basic Usage

const { joke } = require('@s3dking/randomjoke');

// Get jokes from different categories
console.log(joke.dad());
console.log(joke.dark());
console.log(joke.programming());
console.log(joke.puns());

// Get multiple numbered jokes
console.log(joke.dad(3, true));

Rating System

// Rate a joke (type, index, rating)
joke.rateJoke('dad', 0, 5);

// Get top rated jokes
const topJokes = joke.getTopRated('dark', 5);

Tag-Based Filtering

// Get jokes by tag
const programmingJokes = joke.getByTag('programming');
const foodJokes = joke.getByTag('food');

Submit New Jokes

// Submit a new joke
joke.submitJoke(
    "Why do programmers prefer dark mode? Because light attracts bugs!",
    'programming',
    ['programming', 'software'],
    'en'
);

API Reference

Joke Generation

  • joke.dad(amount = 1, numbered = false, minRating = 0)
  • joke.dark(amount = 1, numbered = false, minRating = 0)
  • joke.programming(amount = 1, numbered = false, minRating = 0)
  • joke.puns(amount = 1, numbered = false, minRating = 0)

Rating System

  • joke.rateJoke(type, index, rating)
  • joke.getTopRated(type, limit = 10)

Tag System

  • joke.getByTag(tag)

Custom Jokes

  • joke.submitJoke(text, type, tags = [], language = 'en')
  • joke.custom(jokes, amount = 1, numbered = false)

Advanced Generation

  • joke.generate({ type, numbered = false, jokes = 1 })

Error Handling

  • Invalid joke types will throw an error
  • Ratings must be between 1 and 5
  • Joke submissions require valid type and text
  • Cache is automatically cleared on joke submissions

Breaking Changes from v1.x

  1. Joke objects now include ratings and tags
  2. New categories: programming and puns
  3. Modified return format for rated jokes
  4. New dependencies added
  5. CLI command structure changes