Skip to content

demotivator

demotivator is an open-source npm package containing a curated collection of insults organized into themed packs. It is maintained by PorkyProductions and licensed under the Apache License 2.0.

The package is designed to be reusable and extensible — it ships both raw insult data and utility functions for selecting, combining, and retrieving insults programmatically. It serves as the data layer for the (de)Motivator web app, but can be used independently in any JavaScript or TypeScript project.

Terminal window
npm install demotivator

There are three ways to use the package depending on your preference: named imports for tree-shaking, the deMotivator object for a namespace-style API, or the DeMotivator class for an instance-based approach.

import { generateInsult, insults, createArray, makeAngry } from 'demotivator';
// Random insult from the original pack
const insult = generateInsult(insults);
// Random insult from a custom combination of packs
const pool = createArray({ packs: ['original', 'halloween'] });
const seasonalInsult = generateInsult(pool);
const dramatic = makeAngry(seasonalInsult);
import deMotivator from 'demotivator';
const insult = deMotivator.generateInsult(deMotivator.insults);
import { DeMotivator } from 'demotivator';
const dm = new DeMotivator();
// Defaults to the 'original' pack when no array is provided
const insult = dm.generateInsult();

The package source lives in packages/demotivator/ within the monorepo and is published to npm as demotivator. Internally it is organized into four modules:

ModulePurpose
typings.tsAll TypeScript types and interfaces
insults.tsRaw insult arrays, pack definitions, and the pack registry
generateinsult.tsFunctions for selecting insults from an array
index.tsPublic API surface — re-exports, createArray, deMotivator object, and DeMotivator class
  • Types — TypeScript type definitions and interfaces
  • Packs — How the insult pack system works
  • API Reference — Every exported function, object, and class