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

txtgen

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

txtgen - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

dist/txtgen.min.map

133

dist/txtgen.js
/**
* txtgen
* v1.1.0
* built: Sat, 27 May 2017 11:33:48 GMT
* git: https://github.com/ndaidong/txtgen
* author: @ndaidong
* txtgen@1.2.0
* built on: Mon, 05 Jun 2017 02:06:28 GMT
* repository: https://github.com/ndaidong/txtgen
* maintainer: @ndaidong
* License: MIT
**/
;(function (name, factory) {
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory();
} else {
var root = window || {};
if (root.define && root.define.amd) {
root.define('txtgen', [], factory);
} else if (root.exports) {
root.exports = factory();
} else {
root[name] = factory();
}
}
})('txtgen', function () {
var _nouns = ['alligator', 'ant', 'bear', 'bee', 'bird', 'camel', 'cat', 'cheetah', 'chicken', 'chimpanzee', 'cow', 'crocodile', 'deer', 'dog', 'dolphin', 'duck', 'eagle', 'elephant', 'fish', 'fly', 'fox', 'frog', 'giraffe', 'goat', 'goldfish', 'hamster', 'hippopotamus', 'horse', 'kangaroo', 'kitten', 'lion', 'lobster', 'monkey', 'octopus', 'owl', 'panda', 'pig', 'puppy', 'rabbit', 'rat', 'scorpion', 'seal', 'shark', 'sheep', 'snail', 'snake', 'spider', 'squirrel', 'tiger', 'turtle', 'wolf', 'zebra', 'apple', 'apricot', 'banana', 'blackberry', 'blueberry', 'cherry', 'cranberry', 'currant', 'fig', 'grape', 'grapefruit', 'grapes', 'kiwi', 'kumquat', 'lemon', 'lime', 'melon', 'nectarine', 'orange', 'peach', 'pear', 'persimmon', 'pineapple', 'plum', 'pomegranate', 'prune', 'raspberry', 'strawberry', 'tangerine', 'watermelon'];
var adjectives = ['adaptable', 'adventurous', 'affable', 'affectionate', 'agreeable', 'alert', 'alluring', 'ambitious', 'ambitious', 'amiable', 'amicable', 'amused', 'amusing', 'boundless', 'brave', 'brave', 'bright', 'bright', 'broad-minded', 'calm', 'calm', 'capable', 'careful', 'charming', 'charming', 'cheerful', 'coherent', 'comfortable', 'communicative', 'compassionate', 'confident', 'conscientious', 'considerate', 'convivial', 'cooperative', 'courageous', 'courageous', 'courteous', 'creative', 'credible', 'cultured', 'dashing', 'dazzling', 'debonair', 'decisive', 'decisive', 'decorous', 'delightful', 'detailed', 'determined', 'determined', 'diligent', 'diligent', 'diplomatic', 'discreet', 'discreet', 'dynamic', 'dynamic', 'eager', 'easygoing', 'efficient', 'elated', 'eminent', 'emotional', 'enchanting', 'encouraging', 'endurable', 'energetic', 'energetic', 'entertaining', 'enthusiastic', 'enthusiastic', 'excellent', 'excited', 'exclusive', 'exuberant', 'exuberant', 'fabulous', 'fair', 'fair-minded', 'faithful', 'faithful', 'fantastic', 'fearless', 'fearless', 'fine', 'forceful', 'frank', 'frank', 'friendly', 'friendly', 'funny', 'funny', 'generous', 'generous', 'gentle', 'gentle', 'glorious', 'good', 'good', 'gregarious', 'happy', 'hard-working', 'harmonious', 'helpful', 'helpful', 'hilarious', 'honest', 'honorable', 'humorous', 'imaginative', 'impartial', 'impartial', 'independent', 'industrious', 'instinctive', 'intellectual', 'intelligent', 'intuitive', 'inventive', 'jolly', 'joyous', 'kind', 'kind', 'kind-hearted', 'knowledgeable', 'level', 'likeable', 'lively', 'lovely', 'loving', 'loving', 'loyal', 'lucky', 'mature', 'modern', 'modest', 'neat', 'nice', 'nice', 'obedient', 'optimistic', 'painstaking', 'passionate', 'patient', 'peaceful', 'perfect', 'persistent', 'philosophical', 'pioneering', 'placid', 'placid', 'plausible', 'pleasant', 'plucky', 'plucky', 'polite', 'powerful', 'practical', 'pro-active', 'productive', 'protective', 'proud', 'punctual', 'quick-witted', 'quiet', 'quiet', 'rational', 'receptive', 'reflective', 'reliable', 'relieved', 'reserved', 'resolute', 'resourceful', 'responsible', 'rhetorical', 'righteous', 'romantic', 'romantic', 'sedate', 'seemly', 'selective', 'self-assured', 'self-confident', 'self-disciplined', 'sensible', 'sensitive', 'sensitive', 'shrewd', 'shy', 'silly', 'sincere', 'sincere', 'skillful', 'smiling', 'sociable', 'splendid', 'steadfast', 'stimulating', 'straightforward', 'successful', 'succinct', 'sympathetic', 'talented', 'thoughtful', 'thoughtful', 'thrifty', 'tidy', 'tough', 'tough', 'trustworthy', 'unassuming', 'unbiased', 'understanding', 'unusual', 'upbeat', 'versatile', 'vigorous', 'vivacious', 'warm', 'warmhearted', 'willing', 'willing', 'wise', 'witty', 'witty', 'wonderful'];
var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];
var sentenceTemplates = ['the {{noun}} is {{a_noun}}', '{{a_noun}} is {{an_adjective}} {{noun}}', 'the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}', 'their {{noun}} was, in this moment, {{an_adjective}} {{noun}}', '{{a_noun}} is {{a_noun}} from the right perspective', 'the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}', '{{an_adjective}} {{noun}} is {{a_noun}} of the mind', 'the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look', 'authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}', 'we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}', 'they were lost without the {{adjective}} {{noun}} that composed their {{noun}}', 'the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}', '{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}', 'few can name {{an_adjective}} {{noun}} that isn\'t {{an_adjective}} {{noun}}', 'some posit the {{adjective}} {{noun}} to be less than {{adjective}}', '{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}', '{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}', 'the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}', '{{a_noun}} is {{a_noun}}\'s {{noun}}', '{{a_noun}} is the {{noun}} of {{a_noun}}', '{{an_adjective}} {{noun}}\'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}', '{{nouns}} are {{adjective}} {{nouns}}', '{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}', 'before {{nouns}}, {{nouns}} were only {{nouns}}', 'those {{nouns}} are nothing more than {{nouns}}', 'some {{adjective}} {{nouns}} are thought of simply as {{nouns}}', 'one cannot separate {{nouns}} from {{adjective}} {{nouns}}', 'the {{nouns}} could be said to resemble {{adjective}} {{nouns}}', '{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}'];
var phrases = ['to be more specific, ', 'in recent years, ', 'however, ', 'by the way', 'of course, ', 'some assert that ', 'if this was somewhat unclear, ', 'unfortunately, that is wrong; on the contrary, ', 'it\'s very tricky, if not impossible, ', 'this could be, or perhaps ', 'this is not to discredit the idea that ', 'we know that ', 'it\'s an undeniable fact, really; ', 'framed in a different way, ', 'what we don\'t know for sure is whether or not ', 'as far as we can estimate, ', 'as far as he is concerned, ', 'the zeitgeist contends that ', 'though we assume the latter, ', 'far from the truth, ', 'extending this logic, ', 'nowhere is it disputed that ', 'in modern times ', 'in ancient times ', 'recent controversy aside, ', 'washing and polishing the car,', 'having been a gymnast, ', 'after a long day at school and work, ', 'waking to the buzz of the alarm clock, ', 'draped neatly on a hanger, ', 'shouting with happiness, '];
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.txtgen = global.txtgen || {})));
}(this, (function (exports) { 'use strict';
var unique = function unique(a) {

@@ -43,23 +22,2 @@ var r = [];

};
var addNouns = function addNouns() {
var ls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var a = _nouns.concat(ls);
_nouns = unique(a);
return _nouns.length;
};
var addAdjectives = function addAdjectives(ls) {
var a = adjectives.concat(ls);
adjectives = unique(a);
return adjectives.length;
};
var addTemplates = function addTemplates(ls) {
var a = sentenceTemplates.concat(ls);
sentenceTemplates = unique(a);
return sentenceTemplates.length;
};
var random = function random(min, max) {

@@ -71,3 +29,2 @@ var offset = min;

};
var rand = function rand(a) {

@@ -80,3 +37,2 @@ var w = void 0;

};
var pickLastPunc = function pickLastPunc() {

@@ -86,3 +42,2 @@ var a = '.......!?!?;...'.split('');

};
var pluralize = function pluralize(word) {

@@ -100,3 +55,2 @@ if (word.endsWith('s')) {

};
var normalize = function normalize(word) {

@@ -109,14 +63,33 @@ var a = 'a';

};
var nouns = ['alligator', 'ant', 'bear', 'bee', 'bird', 'camel', 'cat', 'cheetah', 'chicken', 'chimpanzee', 'cow', 'crocodile', 'deer', 'dog', 'dolphin', 'duck', 'eagle', 'elephant', 'fish', 'fly', 'fox', 'frog', 'giraffe', 'goat', 'goldfish', 'hamster', 'hippopotamus', 'horse', 'kangaroo', 'kitten', 'lion', 'lobster', 'monkey', 'octopus', 'owl', 'panda', 'pig', 'puppy', 'rabbit', 'rat', 'scorpion', 'seal', 'shark', 'sheep', 'snail', 'snake', 'spider', 'squirrel', 'tiger', 'turtle', 'wolf', 'zebra', 'apple', 'apricot', 'banana', 'blackberry', 'blueberry', 'cherry', 'cranberry', 'currant', 'fig', 'grape', 'grapefruit', 'grapes', 'kiwi', 'kumquat', 'lemon', 'lime', 'melon', 'nectarine', 'orange', 'peach', 'pear', 'persimmon', 'pineapple', 'plum', 'pomegranate', 'prune', 'raspberry', 'strawberry', 'tangerine', 'watermelon'];
var adjectives = ['adaptable', 'adventurous', 'affable', 'affectionate', 'agreeable', 'alert', 'alluring', 'ambitious', 'ambitious', 'amiable', 'amicable', 'amused', 'amusing', 'boundless', 'brave', 'brave', 'bright', 'bright', 'broad-minded', 'calm', 'calm', 'capable', 'careful', 'charming', 'charming', 'cheerful', 'coherent', 'comfortable', 'communicative', 'compassionate', 'confident', 'conscientious', 'considerate', 'convivial', 'cooperative', 'courageous', 'courageous', 'courteous', 'creative', 'credible', 'cultured', 'dashing', 'dazzling', 'debonair', 'decisive', 'decisive', 'decorous', 'delightful', 'detailed', 'determined', 'determined', 'diligent', 'diligent', 'diplomatic', 'discreet', 'discreet', 'dynamic', 'dynamic', 'eager', 'easygoing', 'efficient', 'elated', 'eminent', 'emotional', 'enchanting', 'encouraging', 'endurable', 'energetic', 'energetic', 'entertaining', 'enthusiastic', 'enthusiastic', 'excellent', 'excited', 'exclusive', 'exuberant', 'exuberant', 'fabulous', 'fair', 'fair-minded', 'faithful', 'faithful', 'fantastic', 'fearless', 'fearless', 'fine', 'forceful', 'frank', 'frank', 'friendly', 'friendly', 'funny', 'funny', 'generous', 'generous', 'gentle', 'gentle', 'glorious', 'good', 'good', 'gregarious', 'happy', 'hard-working', 'harmonious', 'helpful', 'helpful', 'hilarious', 'honest', 'honorable', 'humorous', 'imaginative', 'impartial', 'impartial', 'independent', 'industrious', 'instinctive', 'intellectual', 'intelligent', 'intuitive', 'inventive', 'jolly', 'joyous', 'kind', 'kind', 'kind-hearted', 'knowledgeable', 'level', 'likeable', 'lively', 'lovely', 'loving', 'loving', 'loyal', 'lucky', 'mature', 'modern', 'modest', 'neat', 'nice', 'nice', 'obedient', 'optimistic', 'painstaking', 'passionate', 'patient', 'peaceful', 'perfect', 'persistent', 'philosophical', 'pioneering', 'placid', 'placid', 'plausible', 'pleasant', 'plucky', 'plucky', 'polite', 'powerful', 'practical', 'pro-active', 'productive', 'protective', 'proud', 'punctual', 'quick-witted', 'quiet', 'quiet', 'rational', 'receptive', 'reflective', 'reliable', 'relieved', 'reserved', 'resolute', 'resourceful', 'responsible', 'rhetorical', 'righteous', 'romantic', 'romantic', 'sedate', 'seemly', 'selective', 'self-assured', 'self-confident', 'self-disciplined', 'sensible', 'sensitive', 'sensitive', 'shrewd', 'shy', 'silly', 'sincere', 'sincere', 'skillful', 'smiling', 'sociable', 'splendid', 'steadfast', 'stimulating', 'straightforward', 'successful', 'succinct', 'sympathetic', 'talented', 'thoughtful', 'thoughtful', 'thrifty', 'tidy', 'tough', 'tough', 'trustworthy', 'unassuming', 'unbiased', 'understanding', 'unusual', 'upbeat', 'versatile', 'vigorous', 'vivacious', 'warm', 'warmhearted', 'willing', 'willing', 'wise', 'witty', 'witty', 'wonderful'];
var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];
var sentenceTemplates = ['the {{noun}} is {{a_noun}}', '{{a_noun}} is {{an_adjective}} {{noun}}', 'the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}', 'their {{noun}} was, in this moment, {{an_adjective}} {{noun}}', '{{a_noun}} is {{a_noun}} from the right perspective', 'the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}', '{{an_adjective}} {{noun}} is {{a_noun}} of the mind', 'the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look', 'authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}', 'we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}', 'they were lost without the {{adjective}} {{noun}} that composed their {{noun}}', 'the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}', '{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}', 'few can name {{an_adjective}} {{noun}} that isn\'t {{an_adjective}} {{noun}}', 'some posit the {{adjective}} {{noun}} to be less than {{adjective}}', '{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}', '{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}', 'the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}', '{{a_noun}} is {{a_noun}}\'s {{noun}}', '{{a_noun}} is the {{noun}} of {{a_noun}}', '{{an_adjective}} {{noun}}\'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}', '{{nouns}} are {{adjective}} {{nouns}}', '{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}', 'before {{nouns}}, {{nouns}} were only {{nouns}}', 'those {{nouns}} are nothing more than {{nouns}}', 'some {{adjective}} {{nouns}} are thought of simply as {{nouns}}', 'one cannot separate {{nouns}} from {{adjective}} {{nouns}}', 'the {{nouns}} could be said to resemble {{adjective}} {{nouns}}', '{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}'];
var phrases = ['to be more specific, ', 'in recent years, ', 'however, ', 'by the way', 'of course, ', 'some assert that ', 'if this was somewhat unclear, ', 'unfortunately, that is wrong; on the contrary, ', 'it\'s very tricky, if not impossible, ', 'this could be, or perhaps ', 'this is not to discredit the idea that ', 'we know that ', 'it\'s an undeniable fact, really; ', 'framed in a different way, ', 'what we don\'t know for sure is whether or not ', 'as far as we can estimate, ', 'as far as he is concerned, ', 'the zeitgeist contends that ', 'though we assume the latter, ', 'far from the truth, ', 'extending this logic, ', 'nowhere is it disputed that ', 'in modern times ', 'in ancient times ', 'recent controversy aside, ', 'washing and polishing the car,', 'having been a gymnast, ', 'after a long day at school and work, ', 'waking to the buzz of the alarm clock, ', 'draped neatly on a hanger, ', 'shouting with happiness, '];
var addNouns = function addNouns() {
var ls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var a = nouns.concat(ls);
nouns = unique(a);
return nouns.length;
};
var addAdjectives = function addAdjectives(ls) {
var a = adjectives.concat(ls);
adjectives = unique(a);
return adjectives.length;
};
var addTemplates = function addTemplates(ls) {
var a = sentenceTemplates.concat(ls);
sentenceTemplates = unique(a);
return sentenceTemplates.length;
};
var actions = ['noun', 'a_noun', 'nouns', 'adjective', 'an_adjective'];
var generator = {
noun: function noun() {
return rand(_nouns);
return rand(nouns);
},
a_noun: function a_noun() {
return normalize(rand(_nouns));
return normalize(rand(nouns));
},
nouns: function nouns() {
return pluralize(rand(_nouns));
nouns: function nouns$$1() {
return pluralize(rand(nouns));
},

@@ -130,11 +103,8 @@ adjective: function adjective() {

};
var trim = function trim(s) {
return s.replace(/^[\s\xa0]+|[\s\xa0]+$/g, '').replace(/\r?\n|\r/g, ' ').replace(/\s\s+|\r/g, ' ');
};
var make = function make(template) {
var sentence = template;
var occurrences = template.match(/\{\{(.+?)\}\}/g);
if (occurrences && occurrences.length) {

@@ -152,3 +122,2 @@ for (var i = 0; i < occurrences.length; i++) {

};
var randomStartingPhrase = function randomStartingPhrase() {

@@ -160,8 +129,6 @@ if (Math.random() < 0.33) {

};
var makeSentenceFromTemplate = function makeSentenceFromTemplate() {
return make(rand(sentenceTemplates));
};
var makeSentence = function makeSentence() {
var sentence = function sentence() {
var phrase = randomStartingPhrase();

@@ -173,6 +140,4 @@ var s = phrase + makeSentenceFromTemplate();

};
var makeParagraph = function makeParagraph() {
var paragraph = function paragraph() {
var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
if (!len) {

@@ -184,3 +149,3 @@ len = random(3, 10);

while (a.length < t) {
var s = makeSentence();
var s = sentence();
a.push(s);

@@ -190,6 +155,4 @@ }

};
var makeArticle = function makeArticle() {
var article = function article() {
var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
if (!len) {

@@ -201,3 +164,3 @@ len = random(3, 10);

while (a.length < t) {
var s = makeParagraph();
var s = paragraph();
a.push(s);

@@ -207,11 +170,9 @@ }

};
return {
sentence: makeSentence,
paragraph: makeParagraph,
article: makeArticle,
addNouns: addNouns,
addAdjectives: addAdjectives,
addTemplates: addTemplates
};
});
exports.sentence = sentence;
exports.paragraph = paragraph;
exports.article = article;
exports.addNouns = addNouns;
exports.addAdjectives = addAdjectives;
exports.addTemplates = addTemplates;
Object.defineProperty(exports, '__esModule', { value: true });
})));

@@ -1,2 +0,2 @@

// txtgen@1.1.0, by @ndaidong - built on Sat, 27 May 2017 11:33:48 GMT - published under MIT license
;!function(e,n){if("undefined"!=typeof module&&module.exports)module.exports=n();else{var t=window||{};t.define&&t.define.amd?t.define("txtgen",[],n):t.exports?t.exports=n():t.txtgen=n()}}(0,function(){var e=["alligator","ant","bear","bee","bird","camel","cat","cheetah","chicken","chimpanzee","cow","crocodile","deer","dog","dolphin","duck","eagle","elephant","fish","fly","fox","frog","giraffe","goat","goldfish","hamster","hippopotamus","horse","kangaroo","kitten","lion","lobster","monkey","octopus","owl","panda","pig","puppy","rabbit","rat","scorpion","seal","shark","sheep","snail","snake","spider","squirrel","tiger","turtle","wolf","zebra","apple","apricot","banana","blackberry","blueberry","cherry","cranberry","currant","fig","grape","grapefruit","grapes","kiwi","kumquat","lemon","lime","melon","nectarine","orange","peach","pear","persimmon","pineapple","plum","pomegranate","prune","raspberry","strawberry","tangerine","watermelon"],n=["adaptable","adventurous","affable","affectionate","agreeable","alert","alluring","ambitious","ambitious","amiable","amicable","amused","amusing","boundless","brave","brave","bright","bright","broad-minded","calm","calm","capable","careful","charming","charming","cheerful","coherent","comfortable","communicative","compassionate","confident","conscientious","considerate","convivial","cooperative","courageous","courageous","courteous","creative","credible","cultured","dashing","dazzling","debonair","decisive","decisive","decorous","delightful","detailed","determined","determined","diligent","diligent","diplomatic","discreet","discreet","dynamic","dynamic","eager","easygoing","efficient","elated","eminent","emotional","enchanting","encouraging","endurable","energetic","energetic","entertaining","enthusiastic","enthusiastic","excellent","excited","exclusive","exuberant","exuberant","fabulous","fair","fair-minded","faithful","faithful","fantastic","fearless","fearless","fine","forceful","frank","frank","friendly","friendly","funny","funny","generous","generous","gentle","gentle","glorious","good","good","gregarious","happy","hard-working","harmonious","helpful","helpful","hilarious","honest","honorable","humorous","imaginative","impartial","impartial","independent","industrious","instinctive","intellectual","intelligent","intuitive","inventive","jolly","joyous","kind","kind","kind-hearted","knowledgeable","level","likeable","lively","lovely","loving","loving","loyal","lucky","mature","modern","modest","neat","nice","nice","obedient","optimistic","painstaking","passionate","patient","peaceful","perfect","persistent","philosophical","pioneering","placid","placid","plausible","pleasant","plucky","plucky","polite","powerful","practical","pro-active","productive","protective","proud","punctual","quick-witted","quiet","quiet","rational","receptive","reflective","reliable","relieved","reserved","resolute","resourceful","responsible","rhetorical","righteous","romantic","romantic","sedate","seemly","selective","self-assured","self-confident","self-disciplined","sensible","sensitive","sensitive","shrewd","shy","silly","sincere","sincere","skillful","smiling","sociable","splendid","steadfast","stimulating","straightforward","successful","succinct","sympathetic","talented","thoughtful","thoughtful","thrifty","tidy","tough","tough","trustworthy","unassuming","unbiased","understanding","unusual","upbeat","versatile","vigorous","vivacious","warm","warmhearted","willing","willing","wise","witty","witty","wonderful"],t=["a","e","i","o","u","y"],a=["the {{noun}} is {{a_noun}}","{{a_noun}} is {{an_adjective}} {{noun}}","the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}","their {{noun}} was, in this moment, {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}} from the right perspective","the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}","{{an_adjective}} {{noun}} is {{a_noun}} of the mind","the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look","authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}","we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}","they were lost without the {{adjective}} {{noun}} that composed their {{noun}}","the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}","{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}","few can name {{an_adjective}} {{noun}} that isn't {{an_adjective}} {{noun}}","some posit the {{adjective}} {{noun}} to be less than {{adjective}}","{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}","{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}","the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}}'s {{noun}}","{{a_noun}} is the {{noun}} of {{a_noun}}","{{an_adjective}} {{noun}}'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}","{{nouns}} are {{adjective}} {{nouns}}","{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}","before {{nouns}}, {{nouns}} were only {{nouns}}","those {{nouns}} are nothing more than {{nouns}}","some {{adjective}} {{nouns}} are thought of simply as {{nouns}}","one cannot separate {{nouns}} from {{adjective}} {{nouns}}","the {{nouns}} could be said to resemble {{adjective}} {{nouns}}","{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}"],i=["to be more specific, ","in recent years, ","however, ","by the way","of course, ","some assert that ","if this was somewhat unclear, ","unfortunately, that is wrong; on the contrary, ","it's very tricky, if not impossible, ","this could be, or perhaps ","this is not to discredit the idea that ","we know that ","it's an undeniable fact, really; ","framed in a different way, ","what we don't know for sure is whether or not ","as far as we can estimate, ","as far as he is concerned, ","the zeitgeist contends that ","though we assume the latter, ","far from the truth, ","extending this logic, ","nowhere is it disputed that ","in modern times ","in ancient times ","recent controversy aside, ","washing and polishing the car,","having been a gymnast, ","after a long day at school and work, ","waking to the buzz of the alarm clock, ","draped neatly on a hanger, ","shouting with happiness, "],o=function(e){for(var n=[],t=0;t<e.length;t++)-1===n.indexOf(e[t])&&n.push(e[t]);return n},r=function(e,n){var t=e,a=n-e+1;return Math.floor(Math.random()*a)+t},s=function(e){for(var n=void 0;!n;)n=e[r(0,e.length-1)];return n},u=function(){var e=".......!?!?;...".split("");return s(e)},c=function(e){return e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!t.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s")},l=function(e){var n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),n+" "+e},d=["noun","a_noun","nouns","adjective","an_adjective"],h={noun:function(){return s(e)},a_noun:function(){return l(s(e))},nouns:function(){return c(s(e))},adjective:function(){return s(n)},an_adjective:function(){return l(s(n))}},f=function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," ")},g=function(e){var n=e,t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(var a=0;a<t.length;a++){var i=f(t[a].replace("{{","").replace("}}","")),o=void 0;d.includes(i)&&(o=h[i]()),n=n.replace(t[a],o)}return n},p=function(){return Math.random()<.33?s(i):""},v=function(){return g(s(a))},m=function(){var e=p()+v();return e=e.charAt(0).toUpperCase()+e.slice(1),e+=u()},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e||(e=r(3,10));for(var n=Math.min(e,15),t=[];t.length<n;){var a=m();t.push(a)}return t.join(" ")};return{sentence:m,paragraph:b,article:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e||(e=r(3,10));for(var n=Math.min(e,15),t=[];t.length<n;){var a=b();t.push(a)}return t.join("\n\n")},addNouns:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.concat(n);return(e=o(t)).length},addAdjectives:function(e){var t=n.concat(e);return(n=o(t)).length},addTemplates:function(e){var n=a.concat(e);return(a=o(n)).length}}});
// txtgen@1.2.0, by @ndaidong - built on Mon, 05 Jun 2017 02:06:28 GMT - published under MIT license
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.txtgen=e.txtgen||{})}(this,function(e){"use strict";var n=function(e){for(var n=[],t=0;t<e.length;t++)-1===n.indexOf(e[t])&&n.push(e[t]);return n},t=function(e,n){var t=e,a=n-e+1;return Math.floor(Math.random()*a)+t},a=function(e){for(var n=void 0;!n;)n=e[t(0,e.length-1)];return n},i=function(){var e=".......!?!?;...".split("");return a(e)},o=function(e){return e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!c.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s")},r=function(e){var n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),n+" "+e},s=["alligator","ant","bear","bee","bird","camel","cat","cheetah","chicken","chimpanzee","cow","crocodile","deer","dog","dolphin","duck","eagle","elephant","fish","fly","fox","frog","giraffe","goat","goldfish","hamster","hippopotamus","horse","kangaroo","kitten","lion","lobster","monkey","octopus","owl","panda","pig","puppy","rabbit","rat","scorpion","seal","shark","sheep","snail","snake","spider","squirrel","tiger","turtle","wolf","zebra","apple","apricot","banana","blackberry","blueberry","cherry","cranberry","currant","fig","grape","grapefruit","grapes","kiwi","kumquat","lemon","lime","melon","nectarine","orange","peach","pear","persimmon","pineapple","plum","pomegranate","prune","raspberry","strawberry","tangerine","watermelon"],u=["adaptable","adventurous","affable","affectionate","agreeable","alert","alluring","ambitious","ambitious","amiable","amicable","amused","amusing","boundless","brave","brave","bright","bright","broad-minded","calm","calm","capable","careful","charming","charming","cheerful","coherent","comfortable","communicative","compassionate","confident","conscientious","considerate","convivial","cooperative","courageous","courageous","courteous","creative","credible","cultured","dashing","dazzling","debonair","decisive","decisive","decorous","delightful","detailed","determined","determined","diligent","diligent","diplomatic","discreet","discreet","dynamic","dynamic","eager","easygoing","efficient","elated","eminent","emotional","enchanting","encouraging","endurable","energetic","energetic","entertaining","enthusiastic","enthusiastic","excellent","excited","exclusive","exuberant","exuberant","fabulous","fair","fair-minded","faithful","faithful","fantastic","fearless","fearless","fine","forceful","frank","frank","friendly","friendly","funny","funny","generous","generous","gentle","gentle","glorious","good","good","gregarious","happy","hard-working","harmonious","helpful","helpful","hilarious","honest","honorable","humorous","imaginative","impartial","impartial","independent","industrious","instinctive","intellectual","intelligent","intuitive","inventive","jolly","joyous","kind","kind","kind-hearted","knowledgeable","level","likeable","lively","lovely","loving","loving","loyal","lucky","mature","modern","modest","neat","nice","nice","obedient","optimistic","painstaking","passionate","patient","peaceful","perfect","persistent","philosophical","pioneering","placid","placid","plausible","pleasant","plucky","plucky","polite","powerful","practical","pro-active","productive","protective","proud","punctual","quick-witted","quiet","quiet","rational","receptive","reflective","reliable","relieved","reserved","resolute","resourceful","responsible","rhetorical","righteous","romantic","romantic","sedate","seemly","selective","self-assured","self-confident","self-disciplined","sensible","sensitive","sensitive","shrewd","shy","silly","sincere","sincere","skillful","smiling","sociable","splendid","steadfast","stimulating","straightforward","successful","succinct","sympathetic","talented","thoughtful","thoughtful","thrifty","tidy","tough","tough","trustworthy","unassuming","unbiased","understanding","unusual","upbeat","versatile","vigorous","vivacious","warm","warmhearted","willing","willing","wise","witty","witty","wonderful"],c=["a","e","i","o","u","y"],l=["the {{noun}} is {{a_noun}}","{{a_noun}} is {{an_adjective}} {{noun}}","the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}","their {{noun}} was, in this moment, {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}} from the right perspective","the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}","{{an_adjective}} {{noun}} is {{a_noun}} of the mind","the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look","authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}","we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}","they were lost without the {{adjective}} {{noun}} that composed their {{noun}}","the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}","{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}","few can name {{an_adjective}} {{noun}} that isn't {{an_adjective}} {{noun}}","some posit the {{adjective}} {{noun}} to be less than {{adjective}}","{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}","{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}","the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}}'s {{noun}}","{{a_noun}} is the {{noun}} of {{a_noun}}","{{an_adjective}} {{noun}}'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}","{{nouns}} are {{adjective}} {{nouns}}","{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}","before {{nouns}}, {{nouns}} were only {{nouns}}","those {{nouns}} are nothing more than {{nouns}}","some {{adjective}} {{nouns}} are thought of simply as {{nouns}}","one cannot separate {{nouns}} from {{adjective}} {{nouns}}","the {{nouns}} could be said to resemble {{adjective}} {{nouns}}","{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}"],d=["to be more specific, ","in recent years, ","however, ","by the way","of course, ","some assert that ","if this was somewhat unclear, ","unfortunately, that is wrong; on the contrary, ","it's very tricky, if not impossible, ","this could be, or perhaps ","this is not to discredit the idea that ","we know that ","it's an undeniable fact, really; ","framed in a different way, ","what we don't know for sure is whether or not ","as far as we can estimate, ","as far as he is concerned, ","the zeitgeist contends that ","though we assume the latter, ","far from the truth, ","extending this logic, ","nowhere is it disputed that ","in modern times ","in ancient times ","recent controversy aside, ","washing and polishing the car,","having been a gymnast, ","after a long day at school and work, ","waking to the buzz of the alarm clock, ","draped neatly on a hanger, ","shouting with happiness, "],h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=s.concat(e);return(s=n(t)).length},f=function(e){var t=u.concat(e);return(u=n(t)).length},p=function(e){var t=l.concat(e);return(l=n(t)).length},g=["noun","a_noun","nouns","adjective","an_adjective"],v={noun:function(){return a(s)},a_noun:function(){return r(a(s))},nouns:function(){return o(a(s))},adjective:function(){return a(u)},an_adjective:function(){return r(a(u))}},m=function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," ")},b=function(e){var n=e,t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(var a=0;a<t.length;a++){var i=m(t[a].replace("{{","").replace("}}","")),o=void 0;g.includes(i)&&(o=v[i]()),n=n.replace(t[a],o)}return n},y=function(){return Math.random()<.33?a(d):""},w=function(){return b(a(l))},_=function(){var e=y()+w();return e=e.charAt(0).toUpperCase()+e.slice(1),e+=i()},j=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e||(e=t(3,10));for(var n=Math.min(e,15),a=[];a.length<n;){var i=_();a.push(i)}return a.join(" ")},k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e||(e=t(3,10));for(var n=Math.min(e,15),a=[];a.length<n;){var i=j();a.push(i)}return a.join("\n\n")};e.sentence=_,e.paragraph=j,e.article=k,e.addNouns=h,e.addAdjectives=f,e.addTemplates=p,Object.defineProperty(e,"__esModule",{value:!0})});
{
"version": "1.1.0",
"version": "1.2.0",
"name": "txtgen",

@@ -11,33 +11,52 @@ "description": "Util for generating random sentences, paragraphs and articles in English",

"author": "@ndaidong",
"main": "./index.js",
"main": "./dist/bella.js",
"module": "./src/main",
"jsnext:main": "./src/main",
"browser": "./dist/txtgen.min.js",
"engines": {
"node": ">= 6.0.0"
"node": ">= 6.0"
},
"scripts": {
"lint": "eslint .",
"lint": "eslint src tests/specs",
"nsp": "nsp check --output checkstyle",
"tape": "nyc tape test/start.js | tap-spec",
"report": "nyc report --reporter=lcov",
"tape": "nyc babel-node node_modules/.bin/tape tests/start.js | tap-spec",
"report": "nyc report --reporter=lcov > coverage.lcov && codecov",
"pretest": "npm run lint && npm run nsp",
"test": "npm run tape",
"posttest": "npm run report",
"coveralls": "npm test && cat ./coverage/lcov.info | coveralls",
"build": "gccmin"
"posttest": "CODECOV_TOKEN=0f80ffa2-ed0e-4501-ac91-49397be8b3fe npm run report",
"start": "babel-node src/main",
"build": "gccmin -e src/main.js -n txtgen -o dist -p package.json",
"reset": "node reset"
},
"devDependencies": {
"bellajs": "6.x.x",
"coveralls": "2.x.x",
"babel-cli": "6.x.x",
"babel-plugin-transform-remove-strict-mode": "0.x.x",
"babel-preset-env": "1.x.x",
"codecov": "2.x.x",
"eslint": "3.x.x",
"eslint-config-ggc": "1.x.x",
"gcc-min": "3.x.x",
"gcc-min": "5.x.x",
"nsp": "2.x.x",
"nyc": "10.x.x",
"nyc": "11.x.x",
"tap-spec": "4.x.x",
"tape": "4.x.x"
},
"gccmin": {
"source": "src",
"target": "dist",
"filename": "txtgen",
"globalVar": "txtgen"
"babel": {
"presets": [
[
"env",
{
"targets": {
"browsers": [
"> 1%"
]
}
}
]
],
"plugins": [
[
"transform-remove-strict-mode"
]
]
},

@@ -44,0 +63,0 @@ "keywords": [

@@ -6,3 +6,3 @@ # txtgen

[![Build Status](https://travis-ci.org/ndaidong/txtgen.svg?branch=master)](https://travis-ci.org/ndaidong/txtgen)
[![Coverage Status](https://coveralls.io/repos/github/ndaidong/txtgen/badge.svg?branch=master&noop)](https://coveralls.io/github/ndaidong/txtgen?branch=master)
[![codecov](https://codecov.io/gh/ndaidong/txtgen/branch/master/graph/badge.svg)](https://codecov.io/gh/ndaidong/txtgen)
[![Dependency Status](https://gemnasium.com/badges/github.com/ndaidong/txtgen.svg)](https://gemnasium.com/github.com/ndaidong/txtgen)

@@ -22,3 +22,3 @@ [![NSP Status](https://nodesecurity.io/orgs/techpush/projects/1b2672cb-6712-436d-bd2c-c122892775bb/badge)](https://nodesecurity.io/orgs/techpush/projects/1b2672cb-6712-436d-bd2c-c122892775bb)

```
npm install txtgen --save
npm install txtgen
```

@@ -30,9 +30,9 @@

- [txtgen.min.js](https://cdn.rawgit.com/ndaidong/txtgen/master/dist/txtgen.min.js)
- [txtgen.min.map](https://cdn.rawgit.com/ndaidong/txtgen/master/dist/txtgen.min.map)
- Also supports ES6 Module, CommonJS, AMD and UMD style.
- This library also supports ES6 Module, AMD and UMD style.
### Usage
# Usage
```

@@ -51,3 +51,3 @@ var txtgen = require('txtgen');

# APIs
## APIs

@@ -57,9 +57,39 @@ - .sentence()

- .article([Number totalParagraphs])
- .addNouns([Array nouns])
- .addAdjectives([Array adjectives])
- .addTemplates([Array sentenceTemplates])
- .addNouns(Array nouns)
- .addAdjectives(Array adjectives)
- .addTemplates(Array sentenceTemplates)
# Test
### Template
If you want to add more kinds of sentence, just use `.addTemplates()` method. It expects a list of sentence templates.
Each of sentence template is an English sentence, with the placeholders that can be replaced with any alternative word.
For example:
```
import {
addTemplates
} from 'txtgen';
let templates = [
'{{a_noun}} is {{a_noun}} from the right perspective',
'the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}'
];
addTemplates(templates);
```
Here are the available placeholders:
- noun
- nouns
- a_noun
- adjective
- an_adjective
## Test
```
git clone https://github.com/ndaidong/txtgen.git

@@ -66,0 +96,0 @@ cd txtgen

@@ -6,147 +6,23 @@ /**

import {
nouns,
adjectives,
sentenceTemplates,
phrases
} from './sample';
/* eslint-disable */
var nouns = [ 'alligator', 'ant', 'bear', 'bee', 'bird', 'camel', 'cat', 'cheetah', 'chicken', 'chimpanzee', 'cow', 'crocodile', 'deer', 'dog', 'dolphin', 'duck', 'eagle', 'elephant', 'fish', 'fly', 'fox', 'frog', 'giraffe', 'goat', 'goldfish', 'hamster', 'hippopotamus', 'horse', 'kangaroo', 'kitten', 'lion', 'lobster', 'monkey', 'octopus', 'owl', 'panda', 'pig', 'puppy', 'rabbit', 'rat', 'scorpion', 'seal', 'shark', 'sheep', 'snail', 'snake', 'spider', 'squirrel', 'tiger', 'turtle', 'wolf', 'zebra', 'apple', 'apricot', 'banana', 'blackberry', 'blueberry', 'cherry', 'cranberry', 'currant', 'fig', 'grape', 'grapefruit', 'grapes', 'kiwi', 'kumquat', 'lemon', 'lime', 'melon', 'nectarine', 'orange', 'peach', 'pear', 'persimmon', 'pineapple', 'plum', 'pomegranate', 'prune', 'raspberry', 'strawberry', 'tangerine', 'watermelon' ];
var adjectives = [ 'adaptable', 'adventurous', 'affable', 'affectionate', 'agreeable', 'alert', 'alluring', 'ambitious', 'ambitious', 'amiable', 'amicable', 'amused', 'amusing', 'boundless', 'brave', 'brave', 'bright', 'bright', 'broad-minded', 'calm', 'calm', 'capable', 'careful', 'charming', 'charming', 'cheerful', 'coherent', 'comfortable', 'communicative', 'compassionate', 'confident', 'conscientious', 'considerate', 'convivial', 'cooperative', 'courageous', 'courageous', 'courteous', 'creative', 'credible', 'cultured', 'dashing', 'dazzling', 'debonair', 'decisive', 'decisive', 'decorous', 'delightful', 'detailed', 'determined', 'determined', 'diligent', 'diligent', 'diplomatic', 'discreet', 'discreet', 'dynamic', 'dynamic', 'eager', 'easygoing', 'efficient', 'elated', 'eminent', 'emotional', 'enchanting', 'encouraging', 'endurable', 'energetic', 'energetic', 'entertaining', 'enthusiastic', 'enthusiastic', 'excellent', 'excited', 'exclusive', 'exuberant', 'exuberant', 'fabulous', 'fair', 'fair-minded', 'faithful', 'faithful', 'fantastic', 'fearless', 'fearless', 'fine', 'forceful', 'frank', 'frank', 'friendly', 'friendly', 'funny', 'funny', 'generous', 'generous', 'gentle', 'gentle', 'glorious', 'good', 'good', 'gregarious', 'happy', 'hard-working', 'harmonious', 'helpful', 'helpful', 'hilarious', 'honest', 'honorable', 'humorous', 'imaginative', 'impartial', 'impartial', 'independent', 'industrious', 'instinctive', 'intellectual', 'intelligent', 'intuitive', 'inventive', 'jolly', 'joyous', 'kind', 'kind', 'kind-hearted', 'knowledgeable', 'level', 'likeable', 'lively', 'lovely', 'loving', 'loving', 'loyal', 'lucky', 'mature', 'modern', 'modest', 'neat', 'nice', 'nice', 'obedient', 'optimistic', 'painstaking', 'passionate', 'patient', 'peaceful', 'perfect', 'persistent', 'philosophical', 'pioneering', 'placid', 'placid', 'plausible', 'pleasant', 'plucky', 'plucky', 'polite', 'powerful', 'practical', 'pro-active', 'productive', 'protective', 'proud', 'punctual', 'quick-witted', 'quiet', 'quiet', 'rational', 'receptive', 'reflective', 'reliable', 'relieved', 'reserved', 'resolute', 'resourceful', 'responsible', 'rhetorical', 'righteous', 'romantic', 'romantic', 'sedate', 'seemly', 'selective', 'self-assured', 'self-confident', 'self-disciplined', 'sensible', 'sensitive', 'sensitive', 'shrewd', 'shy', 'silly', 'sincere', 'sincere', 'skillful', 'smiling', 'sociable', 'splendid', 'steadfast', 'stimulating', 'straightforward', 'successful', 'succinct', 'sympathetic', 'talented', 'thoughtful', 'thoughtful', 'thrifty', 'tidy', 'tough', 'tough', 'trustworthy', 'unassuming', 'unbiased', 'understanding', 'unusual', 'upbeat', 'versatile', 'vigorous', 'vivacious', 'warm', 'warmhearted', 'willing', 'willing', 'wise', 'witty', 'witty', 'wonderful' ];
import {
random,
rand,
pickLastPunc,
pluralize,
normalize
} from './util';
var vowels = [
'a', 'e', 'i', 'o', 'u', 'y'
];
export {
addNouns,
addAdjectives,
addTemplates
} from './sample';
var sentenceTemplates = [
'the {{noun}} is {{a_noun}}',
'{{a_noun}} is {{an_adjective}} {{noun}}',
'the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}',
'their {{noun}} was, in this moment, {{an_adjective}} {{noun}}',
'{{a_noun}} is {{a_noun}} from the right perspective',
'the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}',
'{{an_adjective}} {{noun}} is {{a_noun}} of the mind',
'the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look',
'authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}',
'we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}',
'they were lost without the {{adjective}} {{noun}} that composed their {{noun}}',
'the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}',
'{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}',
'few can name {{an_adjective}} {{noun}} that isn\'t {{an_adjective}} {{noun}}',
'some posit the {{adjective}} {{noun}} to be less than {{adjective}}',
'{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}',
'{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}',
'the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}',
'{{a_noun}} is {{a_noun}}\'s {{noun}}',
'{{a_noun}} is the {{noun}} of {{a_noun}}',
'{{an_adjective}} {{noun}}\'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}',
'{{nouns}} are {{adjective}} {{nouns}}',
'{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}',
'before {{nouns}}, {{nouns}} were only {{nouns}}',
'those {{nouns}} are nothing more than {{nouns}}',
'some {{adjective}} {{nouns}} are thought of simply as {{nouns}}',
'one cannot separate {{nouns}} from {{adjective}} {{nouns}}',
'the {{nouns}} could be said to resemble {{adjective}} {{nouns}}',
'{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}'
];
var phrases = [
'to be more specific, ',
'in recent years, ',
'however, ',
'by the way',
'of course, ',
'some assert that ',
'if this was somewhat unclear, ',
'unfortunately, that is wrong; on the contrary, ',
'it\'s very tricky, if not impossible, ',
'this could be, or perhaps ',
'this is not to discredit the idea that ',
'we know that ',
'it\'s an undeniable fact, really; ',
'framed in a different way, ',
'what we don\'t know for sure is whether or not ',
'as far as we can estimate, ',
'as far as he is concerned, ',
'the zeitgeist contends that ',
'though we assume the latter, ',
'far from the truth, ',
'extending this logic, ',
'nowhere is it disputed that ',
'in modern times ',
'in ancient times ',
'recent controversy aside, ',
'washing and polishing the car,',
'having been a gymnast, ',
'after a long day at school and work, ',
'waking to the buzz of the alarm clock, ',
'draped neatly on a hanger, ',
'shouting with happiness, '
];
/* eslint-enable */
var unique = (a) => {
let r = [];
for (let i = 0; i < a.length; i++) {
if (r.indexOf(a[i]) === -1) {
r.push(a[i]);
}
}
return r;
};
var addNouns = (ls = []) => {
let a = nouns.concat(ls);
nouns = unique(a);
return nouns.length;
};
var addAdjectives = (ls) => {
let a = adjectives.concat(ls);
adjectives = unique(a);
return adjectives.length;
};
var addTemplates = (ls) => {
let a = sentenceTemplates.concat(ls);
sentenceTemplates = unique(a);
return sentenceTemplates.length;
};
var random = (min, max) => {
let offset = min;
let range = max - min + 1;
let rd = Math.floor(Math.random() * range) + offset;
return rd;
};
var rand = (a) => {
let w;
while (!w) {
w = a[random(0, a.length - 1)];
}
return w;
};
var pickLastPunc = () => {
let a = '.......!?!?;...'.split('');
return rand(a);
};
var pluralize = (word) => {
if (word.endsWith('s')) {
return word;
}
if (word.match(/(ss|ish|ch|x|us)$/)) {
word += 'e';
} else if (word.endsWith('y') && !vowels.includes(word.charAt(word.length - 2))) {
word = word.slice(0, word.length - 1);
word += 'ie';
}
return word + 's';
};
var normalize = (word) => {
let a = 'a';
if (word.match(/^(a|e|i|o)/)) {
a = 'an';
}
return `${a} ${word}`;
};
var actions = [

@@ -209,3 +85,3 @@ 'noun', 'a_noun', 'nouns',

var makeSentence = () => {
export var sentence = () => {
let phrase = randomStartingPhrase();

@@ -218,3 +94,3 @@ let s = phrase + makeSentenceFromTemplate();

var makeParagraph = (len = 0) => {
export var paragraph = (len = 0) => {
if (!len) {

@@ -226,3 +102,3 @@ len = random(3, 10);

while (a.length < t) {
let s = makeSentence();
let s = sentence();
a.push(s);

@@ -233,3 +109,3 @@ }

var makeArticle = (len = 0) => {
export var article = (len = 0) => {
if (!len) {

@@ -241,3 +117,3 @@ len = random(3, 10);

while (a.length < t) {
let s = makeParagraph();
let s = paragraph();
a.push(s);

@@ -247,10 +123,1 @@ }

};
module.exports = {
sentence: makeSentence,
paragraph: makeParagraph,
article: makeArticle,
addNouns,
addAdjectives,
addTemplates
};

Sorry, the diff of this file is not supported yet

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