API Reference

Malarky exports everything you need from the main package entry point:

import {
  // Core
  TextGenerator,

  // Adapters
  SimpleFakerAdapter,
  FakerJsAdapter,

  // Lexicon utilities
  loadLexiconFromString,
  loadLexiconFromObject,
  tryLoadLexicon,
  validateLexicon,
  LexiconStore,

  // RNG
  SeedableRng,

  // Morphology
  pluralize,
  singularize,
  getPastTense,
  getPresentParticiple,
  getThirdPersonSingular,
  getIndefiniteArticle,

  // Transform system
  TransformRegistry,
  createDefaultRegistry,
  tokenize,
  render,
  executePipeline,
} from 'malarky';

Summary

Export Description
TextGenerator Core class for generating text
SimpleFakerAdapter Built-in word provider (zero dependencies)
FakerJsAdapter Adapter for @faker-js/faker (more word variety)
loadLexiconFromString Parse a JSON string into a Lexicon
loadLexiconFromObject Validate and cast an object to a Lexicon
tryLoadLexicon Parse with error handling (returns null on failure)
validateLexicon Validate a lexicon and get errors/warnings
LexiconStore Query and sample from a loaded lexicon
SeedableRng Deterministic random number generator
Morphology utilities Standalone English morphology functions
Transform system Tokenizer, pipeline, registry, and 10 built-in transforms

See the child pages for full details on each area.


Table of contents


Back to top

Malarky © 2026. Distributed under the MIT License.

This site uses Just the Docs, a documentation theme for Jekyll.