package
Generates lorem ipsum placeholder text for Node.js, Deno, browsers, and React Native. Developed with Bun.
npm install lorem-ipsumGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
39.0 kB
Includes dependencies.
Generate words, sentences, and paragraphs of lorem ipsum placeholder text.
Version 3 supports modern JavaScript runtimes, including Node.js, Bun, Deno, modern browsers, and React Native. It has no runtime dependencies and ships ESM, CommonJS, a browser build, CLI, and TypeScript declaration files.
This README is for version 3.
Version 3 is tested with Node.js 22+, Bun 1.3+, and Deno 2+.
Version 3 keeps the public API compatible with version 2 while modernizing the package around current JavaScript runtimes.
The new v3 package is small:
For older documentation:
2-stable branch1-stable branchIf you need compatibility with older versions of Node.js, use lorem-ipsum@2,
which supports Node.js 8 and later.
For truly ancient runtimes, lorem-ipsum@1.0.6 supports Node.js as far back as
0.4.
npm i lorem-ipsum
bun add lorem-ipsum
deno install npm:lorem-ipsumDeno users can import the package from npm with an npm: specifier.
import { loremIpsum } from "npm:lorem-ipsum";
console.log(loremIpsum({ count: 2, units: "sentences" }));The library API works in Deno. The CLI can also run under Deno, though commands that read package metadata or copy to the clipboard may need Deno permissions.
Browsers can load the package directly from UNPKG.
<script src="https://unpkg.com/lorem-ipsum@3"></script>
<script>
console.log(LoremIpsum.loremIpsum({ count: 2, units: "sentences" }));
</script>The default UNPKG entry is minified. You can also request the browser builds explicitly:
<script src="https://unpkg.com/lorem-ipsum@3/dist/index.browser.js"></script>
<script src="https://unpkg.com/lorem-ipsum@3/dist/index.browser.min.js"></script>The class is the recommended API when you want to reuse the same generation options.
import { LoremIpsum } from "lorem-ipsum";
// const { LoremIpsum } = require("lorem-ipsum");
const lorem = new LoremIpsum({
sentencesPerParagraph: {
max: 8,
min: 4,
},
wordsPerSentence: {
max: 16,
min: 4,
},
});
lorem.generateWords(1);
lorem.generateSentences(5);
lorem.generateParagraphs(7);loremIpsum() is a compatibility API for users who prefer the original
function-style interface.
import { loremIpsum } from "lorem-ipsum";
// const { loremIpsum } = require("lorem-ipsum");
loremIpsum(); // Generates one sentence.You can pass options to customize the output.
import { loremIpsum } from "lorem-ipsum";
loremIpsum({
count: 1, // Number of words, sentences, or paragraphs.
format: "plain", // "plain" or "html".
paragraphLowerBound: 3, // Minimum sentences per paragraph.
paragraphUpperBound: 7, // Maximum sentences per paragraph.
random: Math.random, // PRNG function.
sentenceLowerBound: 5, // Minimum words per sentence.
sentenceUpperBound: 15, // Maximum words per sentence.
suffix: "\n", // Line ending for paragraphs.
units: "sentences", // "words", "sentences", or "paragraphs".
words: ["ad", "..."], // Word list to draw from.
Install globally with npm or Bun to use the lorem-ipsum command.
npm i -g lorem-ipsum
bun add --global lorem-ipsum
deno install --global --allow-read --allow-run -n lorem-ipsum npm:lorem-ipsumIf you install with Bun, make sure Bun's global bin directory is on your
PATH. You can find it with bun pm bin -g.
If you install with Deno, make sure Deno's global bin directory is on your
PATH. Deno installs global commands under $HOME/.deno/bin by default.
Use --force to replace an existing Deno install.
lorem-ipsum --version
lorem-ipsum --help
lorem-ipsum 1 word
lorem-ipsum 2 words
lorem-ipsum 1 sentence
lorem-ipsum 2 sentences
lorem-ipsum 1 paragraph
lorem-ipsum 2 paragraphs
lorem-ipsum 2 paragraphs --format html
lorem-ipsum 2 paragraphs --copy
lorem-ipsum 2 paragraphs --format html --copyOn Linux, the --copy option requires xclip.
This project uses Bun for local development, testing, building, and publishing. Bun is not required to use the package at runtime.
bun test
bun run dev
bun run build
bun publishMIT License
Copyright (c) 2012-2026 Nickolas Kenyeres dev@kenyeres.ca
See LICENSE.