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

beyond-ipsum

v0.3.0

Published

A filler text generator defaulting to the beginning lyrics from the song One Step Beyond by Madness

Downloads

14

Readme

beyond-ipsum

🔠 - A filler text generator defaulting to the beginning lyrics from the song One Step Beyond by Madness.

Installation

npm:

npm install beyond-ipsum

HTML:

<script src="beyond-ipsum.min.js"></script>

Usage

ES6:

import BeyondIpsum from 'beyond-ipsum';

const generator = new BeyondIpsum();

Browser:

BeyondIpsum
// or
window.BeyondIpsum

// i.e
var generator = new BeyondIpsum();

Example

import BeyondIpsum from 'beyond-ipsum';

const generator = new BeyondIpsum({
  // Settings for the generator, see section 'Settings'
});

// Get a random sentence
const sentence = generator.getSentence();

console.log(sentence);
// e.g "Move heavy beyond nuttiest well move you've to in."

Settings

var generator = new BeyondIpsum({
  // Settings here
});

| Setting | Type | Default | Description | | --- | --- | --- | --- | | words | Array | The first 42 unique words in the lyrics of One Step beyond by Madness | The words to use | | sentenceLimits | Object | {min: 2, max: 9} | Min/max words in a sentence | | headingLimits | Object | {min: 3, max: 6} | Min/max words in a heading | | paragraphLimits | Object | {min: 4, max: 13} | Min/max sentences in a paragraph | | startSentence | String / boolean | false | Sentence to begin the first paragraph with, false if just random | | startHeading | String / boolean | false | Sentence to use as the first heading, false if just random | | format | String | <h1/><p/><h2/><p/><p/><h2/><p/> | Describe the format of getFormattedContent(). Put the wanted tag names between < and />. Heading tag names will generate headings in them, all other will generate a paragraph as their content | | allowRepeatedWords | Boolean | false | If true, the same word can appear twice in a row |

API

getWord()

Get a random word from the pool of words. If setting allowRepeatedWords is false, this method will not return the same word twice in row.

Returns

{String} A word from the pool.

getSentence()

Returns

{String} Random sentence made up from the pool of words.

getHeading();

Returns

{String} Random text string suitable for headings.

getParagraph()

Returns

{String} Paragraph of text made up from random sentences.

getParagraphs(numberOfParagraphs)

Parameters

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | numberOfParagraphs | Number | 3 | Number of paragraps to return |

Returns

{String} Multiple paragraphs made up from random sentences.

getFormattedContent()

Returns

{String} Formatted random text, based on the format setting.

interpolate(string)

Replace occurences of, for example, {{paragraph}} in the submitted string with randomly generated paragraphs. Also available are {{heading}}, {{sentence}} and {{word}}.

Parameters

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | string | String | "" | The string to interpolate. |

Returns

{String} The same string as the one provided, but with the random good stuff interpolated.

updateSettings(newSettings)

Update/overwrite the settings after instantiation.

Parameters

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | newSettings | Object | {} | Object with the settings to overwrite. |

Returns

{Object} The new settings object

resetDefaultSettings()

Reset to the default settings after instantiation.

Returns

{Object} The new settings object