Generate various types of text content including Lorem ipsum placeholder text, individual words by grammatical category, and programming/hacker terminology. These modules provide essential text generation capabilities for content creation and testing.
Generate traditional Lorem ipsum placeholder text in various formats and lengths.
/**
* Generate a single Lorem ipsum word
* @param options - Word generation options
* @returns Single Lorem ipsum word
*/
word(options?: {
/** Expected length of the word */
length?: number | { min: number; max: number };
/** Strategy when no words match the length requirement */
strategy?: 'fail' | 'shortest' | 'closest' | 'longest' | 'any-length';
}): string;
/**
* Generate multiple Lorem ipsum words
* @param count - Number of words to generate
* @returns Space-separated Lorem ipsum words
*/
words(count?: number | { min: number; max: number }): string;
/**
* Generate a Lorem ipsum sentence
* @param wordCount - Number of words in the sentence
* @returns Lorem ipsum sentence with proper punctuation
*/
sentence(wordCount?: number | { min: number; max: number }): string;
/**
* Generate multiple Lorem ipsum sentences
* @param sentenceCount - Number of sentences to generate
* @returns Multiple sentences separated by spaces
*/
sentences(sentenceCount?: number | { min: number; max: number }): string;
/**
* Generate a Lorem ipsum paragraph
* @param sentenceCount - Number of sentences in the paragraph
* @returns Lorem ipsum paragraph
*/
paragraph(sentenceCount?: number | { min: number; max: number }): string;
/**
* Generate multiple Lorem ipsum paragraphs
* @param paragraphCount - Number of paragraphs to generate
* @param separator - Separator between paragraphs
* @returns Multiple paragraphs with specified separator
*/
paragraphs(paragraphCount?: number | { min: number; max: number }, separator?: string): string;
/**
* Generate Lorem ipsum text lines
* @param lineCount - Number of lines to generate
* @returns Lines separated by newline characters
*/
lines(lineCount?: number | { min: number; max: number }): string;
/**
* Generate mixed Lorem ipsum text
* @returns Randomly generated text between 1 sentence and 3 paragraphs
*/
text(): string;
/**
* Generate a URL-friendly slug from Lorem ipsum words
* @param wordCount - Number of words in the slug
* @returns Hyphenated lowercase slug
*/
slug(wordCount?: number | { min: number; max: number }): string;Usage Examples:
import { faker } from "@faker-js/faker";
// Generate single words
const word = faker.lorem.word();
// Example: 'temporibus'
const shortWord = faker.lorem.word(5);
// Example: 'velit'
const controlledWord = faker.lorem.word({
length: { min: 5, max: 7 },
strategy: 'fail'
});
// Example: 'quaerat'
// Generate multiple words
const words = faker.lorem.words(5);
// Example: 'ad et cum voluptas'
const variableWords = faker.lorem.words({ min: 3, max: 6 });
// Example: 'lorem ipsum dolor sit'
// Generate sentences
const sentence = faker.lorem.sentence();
// Example: 'Voluptatem repudiandae non quia.'
const longSentence = faker.lorem.sentence(10);
// Example: 'Ad sint velit in dolor sit amet consectetur adipiscing elit.'
// Generate paragraphs
const paragraph = faker.lorem.paragraph();
// Example: 'Voluptatem repudiandae non quia. Magni dolores eos qui ratione...'
const paragraphs = faker.lorem.paragraphs(3, '\n\n');
// Example: Multiple paragraphs separated by double newlines
// Generate lines
const lines = faker.lorem.lines(5);
// Example: Lines separated by newline characters
// Generate mixed text
const text = faker.lorem.text();
// Example: Random amount of text between 1 sentence and 3 paragraphs
// Generate URL slugs
const slug = faker.lorem.slug();
// Example: 'lorem-ipsum-dolor'
const longSlug = faker.lorem.slug(5);
// Example: 'voluptatem-repudiandae-non-quia-magni'Generate specific types of words by grammatical category with length and strategy controls.
/**
* Generate an adjective
* @param options - Word generation options
* @returns Random adjective
*/
adjective(options?: WordOptions): string;
/**
* Generate an adverb
* @param options - Word generation options
* @returns Random adverb
*/
adverb(options?: WordOptions): string;
/**
* Generate a conjunction
* @param options - Word generation options
* @returns Random conjunction
*/
conjunction(options?: WordOptions): string;
/**
* Generate an interjection
* @param options - Word generation options
* @returns Random interjection
*/
interjection(options?: WordOptions): string;
/**
* Generate a noun
* @param options - Word generation options
* @returns Random noun
*/
noun(options?: WordOptions): string;
/**
* Generate a preposition
* @param options - Word generation options
* @returns Random preposition
*/
preposition(options?: WordOptions): string;
/**
* Generate a verb
* @param options - Word generation options
* @returns Random verb
*/
verb(options?: WordOptions): string;
interface WordOptions {
/** Expected length of the word */
length?: number | { min: number; max: number };
/** Strategy when no words match the length requirement */
strategy?: 'fail' | 'shortest' | 'closest' | 'longest' | 'any-length';
}Usage Examples:
import { faker } from "@faker-js/faker";
// Generate different types of words
const adjective = faker.word.adjective();
// Example: 'pungent'
const noun = faker.word.noun();
// Example: 'timeline'
const verb = faker.word.verb();
// Example: 'navigate'
const adverb = faker.word.adverb();
// Example: 'silently'
// Generate words with specific lengths
const shortAdjective = faker.word.adjective(5);
// Example: 'slimy'
const longNoun = faker.word.noun({
length: { min: 8, max: 12 },
strategy: 'closest'
});
// Example: 'development'
// Generate words with fallback strategies
const anyAdjective = faker.word.adjective({
length: 20,
strategy: 'any-length'
});
// Example: Falls back to any length if no 20-letter adjectives exist
// Create sentences with specific word types
const sentence = `The ${faker.word.adjective()} ${faker.word.noun()} ${faker.word.verb()} ${faker.word.adverb()}.`;
// Example: 'The pungent timeline navigates silently.'
// Generate multiple words for variety
const adjectives = Array.from({ length: 5 }, () => faker.word.adjective());
// Example: ['bright', 'smooth', 'ancient', 'digital', 'frozen']Generate programming-related terminology and tech jargon for software development contexts.
/**
* Generate a hacker/IT abbreviation
* @returns Random tech abbreviation
*/
abbreviation(): string;
/**
* Generate a hacker/IT adjective
* @returns Random tech adjective
*/
adjective(): string;
/**
* Generate a hacker/IT noun
* @returns Random tech noun
*/
noun(): string;
/**
* Generate a hacker/IT verb
* @returns Random tech verb
*/
verb(): string;
/**
* Generate a hacker/IT verb in -ing form
* @returns Random tech verb in present continuous
*/
ingverb(): string;
/**
* Generate a complete hacker/IT phrase
* @returns Random tech phrase combining multiple terms
*/
phrase(): string;Usage Examples:
import { faker } from "@faker-js/faker";
// Generate individual tech terms
const abbreviation = faker.hacker.abbreviation();
// Example: 'THX'
const techAdjective = faker.hacker.adjective();
// Example: 'cross-platform'
const techNoun = faker.hacker.noun();
// Example: 'protocol'
const techVerb = faker.hacker.verb();
// Example: 'generate'
const techIngVerb = faker.hacker.ingverb();
// Example: 'calculating'
// Generate complete tech phrases
const phrase = faker.hacker.phrase();
// Example: 'Try to calculate the EXE feed, maybe it will index the multi-byte pixel!'
// Create tech-themed content
const techDescription = `Our ${faker.hacker.adjective()} ${faker.hacker.noun()} can ${faker.hacker.verb()} your ${faker.hacker.noun()} by ${faker.hacker.ingverb()} the ${faker.hacker.abbreviation()} ${faker.hacker.noun()}.`;
// Example: 'Our cross-platform protocol can generate your matrix by calculating the THX feed.'
// Generate multiple phrases for variety
const techPhrases = Array.from({ length: 3 }, () => faker.hacker.phrase());
// Example: Array of technical-sounding phrasesimport { faker } from "@faker-js/faker";
// Generate documentation content
const docContent = {
title: faker.lorem.words({ min: 2, max: 4 }),
introduction: faker.lorem.paragraph(),
sections: Array.from({ length: 3 }, () => ({
heading: faker.lorem.sentence({ min: 3, max: 6 }),
content: faker.lorem.paragraphs(2, '\n\n'),
codeExample: `// ${faker.hacker.phrase()}\n${faker.hacker.verb()}(${faker.hacker.noun()});`
})),
conclusion: faker.lorem.paragraph()
};import { faker } from "@faker-js/faker";
const blogPost = {
title: faker.lorem.sentence({ min: 4, max: 8 }),
slug: faker.lorem.slug({ min: 4, max: 6 }),
excerpt: faker.lorem.paragraph(2),
content: faker.lorem.paragraphs({ min: 5, max: 10 }, '\n\n'),
tags: Array.from({ length: faker.number.int({ min: 3, max: 8 }) }, () =>
faker.lorem.word({ length: { min: 4, max: 10 } })
),
techStack: Array.from({ length: 3 }, () => faker.hacker.abbreviation())
};import { faker } from "@faker-js/faker";
// Generate test content with controlled lengths
const testData = {
shortDescription: faker.lorem.sentence({ min: 5, max: 10 }),
mediumDescription: faker.lorem.paragraph({ min: 3, max: 5 }),
longDescription: faker.lorem.paragraphs({ min: 2, max: 4 }),
keywords: Array.from({ length: 10 }, () =>
faker.word.noun({ length: { min: 4, max: 12 } })
),
technicalTerms: Array.from({ length: 5 }, () => faker.hacker.noun())
};Text generation modules respect the current locale:
When generating words with specific length requirements:
fail: Throws error if no words match the lengthshortest: Returns the shortest available wordclosest: Returns word closest to target lengthlongest: Returns the longest available wordany-length: Ignores length requirement and returns any word