lorem-pedia

0.0.4 • Public • Published

Wikiday - generate lorem ipsum filler text from Wikipedia's day page.

The results are an array of words, sentences (default) or paragraphs.

The number of words per sentence, and the number of sentences per paragraph are configurable, and have mostly sensible defaults for the English language.

USAGE

  // loremcli.js
    var lorem = require("wikiday"); 
    var text = new lorem(process.argv.slice(2)); 
   text.on("Ready", function(data) { 
      console.log(data); 
      process.exit(0); 
    }); 
   text.on("Usage", function(data) { 
      console.log("Usage: "); 
      console.log(data); 
      process.exit(0); 
    }); 
   text.on("TimedOut", function(data) { 
      console.error("Wikiday request timedout."); 
      console.log(typeof data); 
      process.kill(process.pid,'SIGTERM'); 
    }); 
$ node loremcli.js -h 

Will list the options (and built-in defaults) handled by the program.

Options

        knownOpts: {  
                      "count" : Number 
                    , "help" : Boolean 
                    , "minWords" : Number 
                    , "maxWords" : Number 
                    , "minSentences" : Number 
                    , "maxSentences" : Number 
                    , "timeOut" : Number 
                    , "units" : [ "words", "sentences", "paragraphs" ]
                    }, 
        shortHands: { 
                       "c" : ["--count"]
                     , "?" : ["--help"]
                     , "h" : ["--help"]
                     , "maxw" : ["--maxWords"]
                     , "mins" : ["--minSentences"]
                     , "maxs" : ["--maxSentences"]
                     , "p" : ["--units", "paragraphs"]
                     , "s" : ["--units", "sentences"]
                     , "t" : ["--timeOut"]
                     , "u" : ["--units"]
                     , "w" : ["--units", "words"]
                     }, 
        defaults: {  
                      "count" : 4 
                    , "minWords" : 5 
                    , "maxWords" : 15 
                    , "minSentences" : 4 
                    , "maxSentences" : 8 
                    , "timeOut" : 5  // seconds  
                    , "units" : "sentences" 
                    }

Package Sidebar

Install

npm i lorem-pedia

Weekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • vsi