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

node-lipsum

v1.0.1

Published

Web service for lipsum.com

Downloads

26

Readme

node-lipsum: lipsum.org Service/CLI for NodeJS

Build Status

Summary

node-lipsum is a NodeJS Module and Command-line Interface combo that provides a service API for lipsum.org, which you may or may not know as the go-to place to generate arbitrary dummy text whenever you need it. Node-lipsum can be used right from the command line by invoking node-lipsum (assuming you've installed it globally) or as a node module. When used as a node module, you can also get access to it's service and parser sub-modules, which can provide fine-grain access to lipsum.org's service.

Use Cases

You can use node-lipsum when you need:

  • Dummy Text for website mocks

  • Fixtures for unit/functional tests

  • Arbitary text that's meaningless

  • A lame excuse to practice ancient Latin

Installation

$ npm install [-g] node-lipsum # note -g is preferred if you want to use the CLI

Usage

There are 2 different ways to use node-lipsum: via the command line, and as a node module.

###The Command-Line Interface ####Basic Dummy Text Retrieval As node-lipsum was built with a specific use case in mind, it is available out of the box via the node-lipsum script. Provided you have installed node-lipsum globally, simply run

$ node-lipsum

This will return you 5 paragraphs of Latin dummy text.

####CLI Options

usage: node-lipsum [-h] [-v] [-s] [-w {paras,words,bytes}] [-a AMOUNT]

The CLI for the NodeJS Lorem Ipsum Service

Optional arguments:
  -h, --help            Show this help message and exit.
  -v, --version         Show program's version number and exit.
  -s, --start-with-lipsum
                        Whether or not the text should start with "Lorem 
                        Ipsum dolor sit amet...".
  -w {paras,words,bytes}, --what {paras,words,bytes}
                        The type of each text structure that will be returned.
                         Choose from "paras" (paragraphs), "words", or "bytes"
  -a AMOUNT, --amount AMOUNT
                        The number of text structures that will be returned. 
                        Defaults to 5.

####Some Examples

# get 1 paragraph of text
$ node-lipsum -a 1

# get 25 words of text, starting with "lorem ipsum"
$ node-lipsum -s -w words -a 25

# the above can alternatively be written like so
$ node-lipsum --start-with-lipsum --what words --amount 25

# print a nice help message
$ node-lipsum -h  # or --help

###The NodeJS Module Inside your .js file:

var Lipsum = require('node-lipsum');
var fs = require('fs');
var lipsum = new Lipsum();
lipsumOpts = {
  start: 'yes',
  what: 'bytes',
  amount: 80
};
lipsum.getText(function(text) {
  fs.writeFile('dummy.txt', text, function(err) {
    if (err) { 
      console.error(err);
    } else {
      console.log("Wrote " + text.length + "characters!");
    }
  });
}, lipsumOpts);

Alternatively, inside your .coffee file:

Lipsum = require "node-lipsum"
fs = require "fs"
lipsum = new Lipsum()
lipsumOpts =
  start: 'yes'
  what: 'bytes'
  amount: 80
lipsum.getText (text) ->
  fs.writeFile 'dummy.txt', text, (err) ->
    if err
      console.error err
    else
      console.log "Wrote #{text.length} characters!"
  , lipsumOpts

Full Dox

Can be found here or within the source code.

Development

###Installation

$ git clone https://github.com/traviskaufman/node-lipsum.git
$ cd node-lipsum/
$ npm install

###Linting the code

$ cake lint

###Compiling

$ cake compile

###Testing

$ cake test

or

$ npm test

They do the same thing

Issues

Please report them here!

License: LGPL

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.