txtgen
Lightweight util for generating random sentences, paragraphs and articles in English. Inspired by Sentencer and metaphorpsum.com.
Demo
See how it works?
Setup
-
Node.js
npm install txtgen --save
-
CDN
txtgen.min.js
<script type="text/javascript" src="https://cdn.rawgit.com/ndaidong/txtgen/master/dist/txtgen.min.js"></script>
-
This library also supports ES6 Module, AMD and UMD style.
Usage
var txtgen = require('txtgen');
let sentence = txtgen.sentence();
console.log(sentence);
let paragraph = txtgen.paragraph();
console.log(paragraph);
let article = txtgen.article();
console.log(article);
APIs
- .sentence()
- .paragraph([Number totalSentences])
- .article([Number totalParagraphs])
- .addNouns([Array nouns])
- .addAdjectives([Array adjectives])
- .addTemplates([Array sentenceTemplates])
Test
git clone https://github.com/ndaidong/txtgen.git
cd txtgen
npm install
npm test
License
The MIT License (MIT)