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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mpecheux/rangen-loremipsum

v0.1.1

Published

Rangen is a suite of random generators and procedural generation tools; rangen-loremipsum creates Lorem ipsum fake text to use as placeholder.

Downloads

3

Readme

Rangen: Lorem Ipsum

Rangen is a suite of random generators and procedural generation tools; rangen-loremipsum creates Lorem ipsum fake text to use as placeholder in your designs, publishing mockups...

TL;DR

The lib provides you with 3 functions:

  • the generateSentence(): generates a simple sentence with random words
  • the generateParagraph(): generates a paragraph with a few Lorem ipsum sentences
  • the generateText(): generates a text with a few Lorem ipsum paragraphs

Installing via NPM

You can install it via NPM (or Yarn):

npm install @mpecheux/rangen-loremipsum
yarn add @mpecheux/rangen-loremipsum

In a Node context, you can then import the package using the require keyword:

const rangenLoremIpsum = require("@mpecheux/rangen-loremipsum");

const sentence = rangenLoremIpsum.generateSentence();
console.log(sentence);
// Pharetra tristique laoreet condimentum facilisis aliquam feugiat.

For ES6 JavaScript, use the import keyword:

import rangenLoremIpsum from "@mpecheux/rangen-loremipsum";

const paragraph = rangenLoremIpsum.generateParagraph();
console.log(paragraph);
// Hendrerit congue maecenas ullamcorper quisque feugiat. Netus risus primis ultricies amet. Netus malesuada faucibus torquent commodo maecenas arcu dictumst. Nostra sit odio mollis aliquam nec congue commodo.

Using CDN versions

You can also use the CDN versions directly if you don't want to install anything:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Rangen: Name - Demo</title>
  <script src="https://unpkg.com/@mpecheux/[email protected]/dist/rangen-loremipsum.min.js"></script>
  <!-- or:
    <script src="https://cdn.jsdelivr.net/npm/@mpecheux/[email protected]/dist/rangen-loremipsum.min.js"></script>
  -->
</head>
<body>
  <div id="container"></div>
  <button onclick="generateText()">Generate!</button>
  <script>
    const generateText = () => {
      const name = RangenLoremIpsum.generateText();
      document.getElementById("container").innerText = name;
    }

    window.onload = () => {
      generateText();
    }
  </script>
</body>
</html>

(Or download them and put them in your project as local dependencies ;) )

Using a custom words list

By default, the lib uses a list of "latin-sounding" words, like "lorem", "ipsum", "dolor", "sit", "amet"...

But, of course, you can pass in your own words list to influence the texts generated by the package! To do so, simply use the wordsList option (that's available for all 3 functions):

const paragraph = rangenLoremIpsum.generateParagraph({
  wordsList: [
    "hello", "world", "tiger", "glass", "other", "cat", "truck",
    "phone", "baby", "test", "difference", "hat", "cap", "car",
    "kitty", "rabbit", "cow", "metal", "wood", "stone"
  ]
});
console.log(paragraph);
// Other baby truck wood cow baby stone world. Wood world cap phone stone baby hello. Car wood truck car kitty test. Phone baby rabbit kitty cat hat truck. Difference glass kitty stone difference.

API

generateSentence()

Parameters:

  • minWords: minimum number of words in the sentence

    [default: 4]

  • maxWords: maximum number of words in the sentence

    [default: 8]

  • wordsList: custom list of words to use in the generator

    [default: null]

const sentence = rangenLoremIpsum.generateSentence({
  minWords: 12,
  maxWords: 20
});
console.log(sentence);
// Rutrum a nostra consequat duis faucibus at luctus lobortis phasellus class proin ut nunc.

generateParagraph()

Parameters:

  • minWords: minimum number of words in each sentence

    [default: 4]

  • maxWords: maximum number of words in each sentence

    [default: 8]

  • minSentences: minimum number of sentences in the paragraph

    [default: 3]

  • maxSentences: maximum number of sentences in the paragraph

    [default: 6]

  • wordsList: custom list of words to use in the generator

    [default: null]

const paragraph = rangenLoremIpsum.generateParagraph({
  minWords: 12,
  maxWords: 20,
  minSentences: 4,
  maxSentences: 6,
});
console.log(paragraph);
// Justo primis tortor porttitor tincidunt donec lobortis felis vel donec blandit aenean curabitur convallis semper libero sociosqu et mauris bibendum. A donec sit fames imperdiet semper tortor volutpat dui facilisis purus velit nam arcu at. Rhoncus vulputate varius consequat per ante tincidunt suspendisse vehicula pharetra aliquet fames enim pulvinar dolor nam curae. Ante dapibus pretium litora tortor mollis vestibulum habitant felis enim quisque aliquam cubilia aliquam tellus auctor turpis vestibulum. Quis sodales mi sed ipsum auctor mattis ultricies diam nostra pulvinar tristique nullam. Enim integer euismod ligula fermentum aliquet dictum ultrices quam velit hac gravida auctor faucibus a nostra rhoncus interdum cras.

generateText()

Parameters:

  • minWords: minimum number of words in each sentence

    [default: 4]

  • maxWords: maximum number of words in each sentence

    [default: 8]

  • minSentences: minimum number of sentences in each paragraph

    [default: 3]

  • maxSentences: maximum number of sentences in each paragraph

    [default: 6]

  • minParagraphs: minimum number of paragraphs in the text

    [default: 2]

  • maxParagraphs: maximum number of paragraphs in the text

    [default: 4]

  • wordsList: custom list of words to use in the generator

    [default: null]

const text = rangenLoremIpsum.generateText({
  minWords: 2,
  maxWords: 5,
  minSentences: 1,
  maxSentences: 3,
  minParagraphs: 4,
  maxParagraphs: 6
});
console.log(text);
// Eros aenean iaculis vehicula accumsan. Fusce enim erat. Elementum taciti nostra.

// Metus ultricies. Arcu tempus metus elementum euismod. Proin fringilla consequat.

// Sollicitudin ligula ultrices congue nec. Purus vestibulum ut ligula egestas. Praesent urna integer.

// Fermentum luctus proin sociosqu. Morbi bibendum.

// Cubilia enim imperdiet iaculis. Fringilla pretium ut. Consectetur non elit ullamcorper.

// Adipiscing neque a quisque erat.