Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lorem-ipsum

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lorem-ipsum - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

lib/clipper.js

76

bin/lorem-ipsum.bin.js
#!/usr/bin/env node
var g = require('./../lib/generator')
, options = { count: 5, units: 'sentences' }
, copy = false
, args = process.argv.slice(2);
for (var i = 0; i < args.length; i++) {
if (args[i].indexOf('-') < 0) {
options.count = args[i];
} else {
switch (args[i]) {
case "--words":
case "--word":
case "-w":
options.units = "words";
break;
case "--sentences":
case "--sentence":
case "-s":
options.units = "sentences";
break;
case "--paragraphs":
case "--paragraph":
case "-p":
options.units = "paragraphs";
break;
case "--copy":
case "-cp":
copy = true;
break;
}
}
}
var optimist = require('optimist')
, generator = require('./../lib/generator')
, clipper = require('./../lib/clipper');
value = g(options);
var options = {}
, arguments = optimist.argv
, loremIpsum = '';
console.log(value);
options.units = arguments.units || 'sentences';
options.count = arguments.count || 1;
options.copy = arguments.copy ? true : false;
options.format = arguments.format || 'plain';
if (copy) {
var exec = require('child_process').exec;
var stat = '';
switch(process.platform) {
case 'darwin':
stat = 'echo "' + value + '" | pbcopy';
break;
case 'win32':
stat = 'echo "' + value + '" | clip';
break;
case 'linux':
stat = 'echo "' + value + '" | xclip -selection clipboard';
break;
}
exec(stat, function(err, stdout, stderr) {
if (err) {
console.log('FAILED TO COPY DATA TO CLIPBOARD!');
}
});
}
// Generate the lorem ipsum text and print it out.
loremIpsum = generator(options);
console.log(loremIpsum);
// Copy the lorem ipsum text to the clipboard.
if (options.copy) {
clipper(loremIpsum, function(err) { err ? process.exit(1) : process.exit() });
} else {
process.exit(); // Successful exit.
}
var generator = function() {
var options = (arguments.length) ? arguments[0] : {}
, count = options.count || 250
, units = options.units || 'words'
, count = options.count || 1
, units = options.units || 'sentences'
, sentenceLowerBound = options.sentenceLowerBound || 5
, sentenceUpperBound = options.sentenceUpperBound || 15
, paragraphLowerBound = options.paragraphLowerBound || 3
, paragraphUpperBound = options.paragraphUpperBound || 7
, paragraphPrefix = options.paragraphPrefix || '<p>'
, paragraphSuffix = options.paragraphSuffix || '</p>'
, paragraphLowerBound = options.paragraphLowerBound || 3
, paragraphUpperBound = options.paragraphUpperBound || 7
, format = options.format || 'plain'
, words = require('./dictionary').words;

@@ -57,3 +56,10 @@

, bounds = {min: 0, max: count}
, string = '';
, string = ''
, prefix = ''
, suffix = "\r\n";
if (format == 'html') {
prefix = '<p>';
suffix = '</p>';
}

@@ -69,3 +75,3 @@ while (bounds.min < bounds.max) {

case 'paragraphs':
string = string + paragraphPrefix + randomParagraph(words, paragraphLowerBound, paragraphUpperBound, sentenceLowerBound, sentenceUpperBound) + paragraphSuffix;
string = string + prefix + randomParagraph(words, paragraphLowerBound, paragraphUpperBound, sentenceLowerBound, sentenceUpperBound) + suffix;
break;

@@ -72,0 +78,0 @@ }

{
"name": "lorem-ipsum",
"version": "0.1.0",
"description": "Generates passages of lorem ipsum text suitable for use a placeholder in web pages, graphics, and more.",
"author": "Nickolas Kenyeres <nkenyeres@gmail.com> (http://knicklabs.github.com)",
"name": "lorem-ipsum",
"description": "Generate placeholder text using lorem ipsum.",
"version": "0.0.9",
"repository": {
"type": "git",
"url": "git://github.com/knicklabs/node-lorem-ipsum.git"
"license": "MIT/X11",
"main": "./lib/generator",
"dependencies": {
"optimist": "~0.3.5"
},
"engines": {
"node": "*"
},
"dependencies": {},
"devDependencies": {},
"main": "./lib/generator",
"optionalDependencies": {},
"bin": {
"lorem-ipsum": "bin/lorem-ipsum.bin.js"
},
"optionalDependencies": {}
"repository": {
"type": "git",
"url": "git://github.com/knicklabs/node-lorem-ipsum.git"
},
"keywords": [
"lorem",
"ipsum",
"placeholder",
"text",
"dummy",
"filler"
],
"engine": {
"node": ">=0.4"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc