Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "txtgen-cjs", | ||
"version": "3.0.0rc1", | ||
"version": "3.0.1", | ||
"main": "./txtgen.js" | ||
} |
/** | ||
* txtgen@3.0.0rc1 | ||
* built with esbuild at: 2022-01-02T15:18:54.058Z | ||
* txtgen@3.0.1 | ||
* built with esbuild at: 2022-01-07T04:26:08.703Z | ||
* repository: https://github.com/ndaidong/txtgen | ||
@@ -8,4 +8,4 @@ * maintainer: @ndaidong | ||
**/ | ||
var h=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=e=>h(e,"__esModule",{value:!0});var W=(e,n)=>{for(var t in n)h(e,t,{get:n[t],enumerable:!0})},C=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of S(n))!L.call(e,u)&&(t||u!=="default")&&h(e,u,{get:()=>n[u],enumerable:!(a=P(n,u))||a.enumerable});return e};var F=(e=>(n,t)=>e&&e.get(n)||(t=C(R({}),n,1),e&&e.set(n,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var J={};W(J,{addAdjectives:()=>y,addNouns:()=>b,addTemplates:()=>w,article:()=>I,getAdjectives:()=>z,getNouns:()=>x,getTemplates:()=>A,paragraph:()=>$,sentence:()=>M,setAdjectives:()=>_,setNouns:()=>j,setRandom:()=>d,setTemplates:()=>k});var o=["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"],i=["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"],f=["a","e","i","o","u","y"],s=["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}}"],v=["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, "],c=(e=[],n=[])=>[...new Set([...e,...n])],b=(e=[])=>(o=c(o,e),o.length),y=(e=[])=>(i=c(i,e),i.length),w=(e=[])=>(s=c(s,e),s.length),j=(e=[])=>(o=c(o,e),o.length),_=(e=[])=>(i=c(i,e),i.length),k=(e=[])=>(s=c(s,e),s.length),x=()=>[...o],z=()=>[...i],A=()=>[...s];var T,d=e=>{T=e};d(Math.random);var p=()=>T(),l=(e,n)=>{let t=e,a=n-e+1;return Math.floor(p()*a)+t},r=e=>{let n;for(;!n;)n=e[l(0,e.length-1)];return n},N=()=>{let e=".......!?!?;...".split("");return r(e)},q=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!f.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),m=e=>{let n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),`${n} ${e}`};var U=["noun","a_noun","nouns","adjective","an_adjective"],B={noun:()=>r(o),a_noun:()=>m(r(o)),nouns:()=>q(r(o)),adjective:()=>r(i),an_adjective:()=>m(r(i))},D=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),E=e=>{let n=e,t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(let a=0;a<t.length;a++){let u=D(t[a].replace("{{","").replace("}}","")),g;U.includes(u)&&(g=B[u]()),n=n.replace(t[a],g)}return n},G=()=>p()<.33?r(v):"",H=()=>E(r(s));var M=()=>{let n=G()+H();return n=n.charAt(0).toUpperCase()+n.slice(1),n+=N(),n},$=(e=0)=>{e||(e=l(3,10));let n=Math.min(e,15),t=[];for(;t.length<n;){let a=M();t.push(a)}return t.join(" ")},I=(e=0)=>{e||(e=l(3,10));let n=Math.min(e,15),t=[];for(;t.length<n;){let a=$();t.push(a)}return t.join(` | ||
var u=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=e=>u(e,"__esModule",{value:!0});var W=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!L.call(e,o)&&(n||o!=="default")&&u(e,o,{get:()=>t[o],enumerable:!(r=$(t,o))||r.enumerable});return e};var F=(e=>(t,n)=>e&&e.get(t)||(n=C(R({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var J={};W(J,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>I,getAdjectives:()=>z,getNouns:()=>j,getTemplates:()=>A,paragraph:()=>_,sentence:()=>M,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});var a=["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"],i=["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"],m=["a","e","i","o","u","y"],l=["however, {{nouns}} have begun to rent {{nouns}} over the past few months, specifically for {{nouns}} associated with their {{nouns}}"],f=["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, "],p=(e=[],t=[])=>[...new Set([...e,...t])],b=(e=[])=>(a=p(a,e),a.length),v=(e=[])=>(i=p(i,e),i.length),y=(e=[])=>(l=p(l,e),l.length),w=(e=[])=>(a=[...new Set([...e])],a.length),x=(e=[])=>(i=[...new Set([...e])],i.length),k=(e=[])=>(l=[...new Set([...e])],l.length),j=()=>[...a],z=()=>[...i],A=()=>[...l];var T,h=e=>{T=e};h(Math.random);var d=()=>T(),c=(e,t)=>{let n=e,r=t-e+1;return Math.floor(d()*r)+n},s=e=>{let t;for(;!t;)t=e[c(0,e.length-1)];return t},N=()=>{let e=".......!?!?;...".split("");return s(e)},U=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!m.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),S=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},q={noun:()=>s(a),a_noun:()=>S(s(a)),nouns:()=>U(s(a)),adjective:()=>s(i),an_adjective:()=>S(s(i))};var B=["noun","a_noun","nouns","adjective","an_adjective"],D=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),E=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let r=0;r<n.length;r++){let o=D(n[r].replace("{{","").replace("}}","")),g;B.includes(o)&&(g=q[o]()),t=t.replace(n[r],g)}return t},G=()=>d()<.33?s(f):"",H=()=>E(s(l));var M=()=>{let t=G()+H();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=N(),t},_=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length<t;){let r=M();n.push(r)}return n.join(" ")},I=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length<t;){let r=_();n.push(r)}return n.join(` | ||
`)};module.exports=F(J);0&&(module.exports={addAdjectives,addNouns,addTemplates,article,getAdjectives,getNouns,getTemplates,paragraph,sentence,setAdjectives,setNouns,setRandom,setTemplates}); |
/** | ||
* txtgen@3.0.0rc1 | ||
* built with esbuild at: 2022-01-02T15:18:54.058Z | ||
* txtgen@3.0.1 | ||
* built with esbuild at: 2022-01-07T04:26:08.703Z | ||
* repository: https://github.com/ndaidong/txtgen | ||
@@ -8,4 +8,4 @@ * maintainer: @ndaidong | ||
**/ | ||
var a=["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"],i=["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"],m=["a","e","i","o","u","y"],s=["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}}"],g=["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, "],u=(e=[],n=[])=>[...new Set([...e,...n])],w=(e=[])=>(a=u(a,e),a.length),j=(e=[])=>(i=u(i,e),i.length),_=(e=[])=>(s=u(s,e),s.length),k=(e=[])=>(a=u(a,e),a.length),x=(e=[])=>(i=u(i,e),i.length),z=(e=[])=>(s=u(s,e),s.length),A=()=>[...a],T=()=>[...i],N=()=>[...s];var f,v=e=>{f=e};v(Math.random);var l=()=>f(),c=(e,n)=>{let t=e,o=n-e+1;return Math.floor(l()*o)+t},r=e=>{let n;for(;!n;)n=e[c(0,e.length-1)];return n},b=()=>{let e=".......!?!?;...".split("");return r(e)},y=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!m.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),h=e=>{let n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),`${n} ${e}`};var q=["noun","a_noun","nouns","adjective","an_adjective"],M={noun:()=>r(a),a_noun:()=>h(r(a)),nouns:()=>y(r(a)),adjective:()=>r(i),an_adjective:()=>h(r(i))},$=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),P=e=>{let n=e,t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(let o=0;o<t.length;o++){let d=$(t[o].replace("{{","").replace("}}","")),p;q.includes(d)&&(p=M[d]()),n=n.replace(t[o],p)}return n},S=()=>l()<.33?r(g):"",L=()=>P(r(s));var R=()=>{let n=S()+L();return n=n.charAt(0).toUpperCase()+n.slice(1),n+=b(),n},W=(e=0)=>{e||(e=c(3,10));let n=Math.min(e,15),t=[];for(;t.length<n;){let o=R();t.push(o)}return t.join(" ")},E=(e=0)=>{e||(e=c(3,10));let n=Math.min(e,15),t=[];for(;t.length<n;){let o=W();t.push(o)}return t.join(` | ||
var a=["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"],i=["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"],d=["a","e","i","o","u","y"],o=["however, {{nouns}} have begun to rent {{nouns}} over the past few months, specifically for {{nouns}} associated with their {{nouns}}"],g=["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, "],c=(e=[],t=[])=>[...new Set([...e,...t])],w=(e=[])=>(a=c(a,e),a.length),x=(e=[])=>(i=c(i,e),i.length),k=(e=[])=>(o=c(o,e),o.length),j=(e=[])=>(a=[...new Set([...e])],a.length),z=(e=[])=>(i=[...new Set([...e])],i.length),A=(e=[])=>(o=[...new Set([...e])],o.length),T=()=>[...a],N=()=>[...i],S=()=>[...o];var m,f=e=>{m=e};f(Math.random);var u=()=>m(),l=(e,t)=>{let n=e,r=t-e+1;return Math.floor(u()*r)+n},s=e=>{let t;for(;!t;)t=e[l(0,e.length-1)];return t},b=()=>{let e=".......!?!?;...".split("");return s(e)},q=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!d.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),v=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},y={noun:()=>s(a),a_noun:()=>v(s(a)),nouns:()=>q(s(a)),adjective:()=>s(i),an_adjective:()=>v(s(i))};var M=["noun","a_noun","nouns","adjective","an_adjective"],_=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),$=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let r=0;r<n.length;r++){let p=_(n[r].replace("{{","").replace("}}","")),h;M.includes(p)&&(h=y[p]()),t=t.replace(n[r],h)}return t},P=()=>u()<.33?s(g):"",L=()=>$(s(o));var R=()=>{let t=P()+L();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=b(),t},W=(e=0)=>{e||(e=l(3,10));let t=Math.min(e,15),n=[];for(;n.length<t;){let r=R();n.push(r)}return n.join(" ")},E=(e=0)=>{e||(e=l(3,10));let t=Math.min(e,15),n=[];for(;n.length<t;){let r=W();n.push(r)}return n.join(` | ||
`)};export{j as addAdjectives,w as addNouns,_ as addTemplates,E as article,T as getAdjectives,A as getNouns,N as getTemplates,W as paragraph,R as sentence,x as setAdjectives,k as setNouns,v as setRandom,z as setTemplates}; | ||
`)};export{x as addAdjectives,w as addNouns,k as addTemplates,E as article,N as getAdjectives,T as getNouns,S as getTemplates,W as paragraph,R as sentence,z as setAdjectives,j as setNouns,f as setRandom,A as setTemplates}; |
@@ -1,4 +0,4 @@ | ||
// txtgen@3.0.0rc1, by @ndaidong - built with esbuild at 2022-01-02T15:18:54.058Z - published under MIT license | ||
var txtgen=(()=>{var h=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=e=>h(e,"__esModule",{value:!0});var W=(e,n)=>{for(var t in n)h(e,t,{get:n[t],enumerable:!0})},C=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of S(n))!L.call(e,u)&&(t||u!=="default")&&h(e,u,{get:()=>n[u],enumerable:!(a=P(n,u))||a.enumerable});return e};var F=(e=>(n,t)=>e&&e.get(n)||(t=C(R({}),n,1),e&&e.set(n,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var J={};W(J,{addAdjectives:()=>y,addNouns:()=>b,addTemplates:()=>w,article:()=>I,getAdjectives:()=>z,getNouns:()=>x,getTemplates:()=>A,paragraph:()=>$,sentence:()=>M,setAdjectives:()=>_,setNouns:()=>j,setRandom:()=>d,setTemplates:()=>k});var o=["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"],i=["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"],f=["a","e","i","o","u","y"],s=["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}}"],v=["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, "],c=(e=[],n=[])=>[...new Set([...e,...n])],b=(e=[])=>(o=c(o,e),o.length),y=(e=[])=>(i=c(i,e),i.length),w=(e=[])=>(s=c(s,e),s.length),j=(e=[])=>(o=c(o,e),o.length),_=(e=[])=>(i=c(i,e),i.length),k=(e=[])=>(s=c(s,e),s.length),x=()=>[...o],z=()=>[...i],A=()=>[...s];var T,d=e=>{T=e};d(Math.random);var p=()=>T(),l=(e,n)=>{let t=e,a=n-e+1;return Math.floor(p()*a)+t},r=e=>{let n;for(;!n;)n=e[l(0,e.length-1)];return n},N=()=>{let e=".......!?!?;...".split("");return r(e)},q=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!f.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),m=e=>{let n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),`${n} ${e}`};var U=["noun","a_noun","nouns","adjective","an_adjective"],B={noun:()=>r(o),a_noun:()=>m(r(o)),nouns:()=>q(r(o)),adjective:()=>r(i),an_adjective:()=>m(r(i))},D=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),E=e=>{let n=e,t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(let a=0;a<t.length;a++){let u=D(t[a].replace("{{","").replace("}}","")),g;U.includes(u)&&(g=B[u]()),n=n.replace(t[a],g)}return n},G=()=>p()<.33?r(v):"",H=()=>E(r(s));var M=()=>{let n=G()+H();return n=n.charAt(0).toUpperCase()+n.slice(1),n+=N(),n},$=(e=0)=>{e||(e=l(3,10));let n=Math.min(e,15),t=[];for(;t.length<n;){let a=M();t.push(a)}return t.join(" ")},I=(e=0)=>{e||(e=l(3,10));let n=Math.min(e,15),t=[];for(;t.length<n;){let a=$();t.push(a)}return t.join(` | ||
// txtgen@3.0.1, by @ndaidong - built with esbuild at 2022-01-07T04:26:08.703Z - published under MIT license | ||
var txtgen=(()=>{var u=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=e=>u(e,"__esModule",{value:!0});var W=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!L.call(e,o)&&(n||o!=="default")&&u(e,o,{get:()=>t[o],enumerable:!(r=$(t,o))||r.enumerable});return e};var F=(e=>(t,n)=>e&&e.get(t)||(n=C(R({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var J={};W(J,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>I,getAdjectives:()=>z,getNouns:()=>j,getTemplates:()=>A,paragraph:()=>_,sentence:()=>M,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});var a=["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"],i=["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"],m=["a","e","i","o","u","y"],l=["however, {{nouns}} have begun to rent {{nouns}} over the past few months, specifically for {{nouns}} associated with their {{nouns}}"],f=["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, "],p=(e=[],t=[])=>[...new Set([...e,...t])],b=(e=[])=>(a=p(a,e),a.length),v=(e=[])=>(i=p(i,e),i.length),y=(e=[])=>(l=p(l,e),l.length),w=(e=[])=>(a=[...new Set([...e])],a.length),x=(e=[])=>(i=[...new Set([...e])],i.length),k=(e=[])=>(l=[...new Set([...e])],l.length),j=()=>[...a],z=()=>[...i],A=()=>[...l];var T,h=e=>{T=e};h(Math.random);var d=()=>T(),c=(e,t)=>{let n=e,r=t-e+1;return Math.floor(d()*r)+n},s=e=>{let t;for(;!t;)t=e[c(0,e.length-1)];return t},N=()=>{let e=".......!?!?;...".split("");return s(e)},U=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!m.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),S=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},q={noun:()=>s(a),a_noun:()=>S(s(a)),nouns:()=>U(s(a)),adjective:()=>s(i),an_adjective:()=>S(s(i))};var B=["noun","a_noun","nouns","adjective","an_adjective"],D=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),E=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let r=0;r<n.length;r++){let o=D(n[r].replace("{{","").replace("}}","")),g;B.includes(o)&&(g=q[o]()),t=t.replace(n[r],g)}return t},G=()=>d()<.33?s(f):"",H=()=>E(s(l));var M=()=>{let t=G()+H();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=N(),t},_=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length<t;){let r=M();n.push(r)}return n.join(" ")},I=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length<t;){let r=_();n.push(r)}return n.join(` | ||
`)};return F(J);})(); |
{ | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"name": "txtgen", | ||
@@ -20,6 +20,7 @@ "description": "Util for generating random sentences, paragraphs and articles in English", | ||
"dtslint": "dtslint types", | ||
"lint": "standard ./src", | ||
"lint": "standard .", | ||
"pretest": "npm run lint", | ||
"test": "NODE_ENV=test jest --verbose --coverage=true --unhandled-rejections=strict --detectOpenHandles --env=jsdom", | ||
"build": "node build.js src/main.js", | ||
"eval": "node eval", | ||
"reset": "node reset" | ||
@@ -36,4 +37,9 @@ }, | ||
}, | ||
"standard": { | ||
"ignore": [ | ||
"/dist" | ||
] | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": ["dist", "types", "tests"] | ||
"testPathIgnorePatterns": ["dist", "types"] | ||
}, | ||
@@ -40,0 +46,0 @@ "devDependencies": { |
@@ -13,3 +13,3 @@ # txtgen | ||
[See how it works?](http://ndaidong.github.io/txtgen/) | ||
[See how it works?](https://ndaidong.github.io/txtgen/) | ||
@@ -42,19 +42,20 @@ | ||
Sync v14, ECMAScript modules [have became the official standard format](https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_modules_ecmascript_modules). | ||
```js | ||
import { | ||
sentence | ||
} from 'txtgen' | ||
Just [enable](https://nodejs.org/api/packages.html#determining-module-system) and enjoy with ES6 import/export syntax. | ||
// with CommonJS environment | ||
// const { sentence } = require('txtgen/dist/cjs/txtgen.js') | ||
```js | ||
import { sentence } from 'txtgen' | ||
console.log(sentence()) | ||
sentence() | ||
``` | ||
For regular CommonJS environment, `require` can be used as below: | ||
```js | ||
const txtgen = require('txtgen/dist/cjs/txtgen.js') | ||
console.log(txtgen.sentence()) | ||
``` | ||
##### Note: | ||
> Since Node.js v14, ECMAScript modules [have became the official standard format](https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_modules_ecmascript_modules). | ||
> Just ensure that you are [using module system](https://nodejs.org/api/packages.html#determining-module-system) and enjoy with ES6 import/export syntax. | ||
### Browsers: | ||
@@ -131,7 +132,7 @@ | ||
- noun | ||
- nouns | ||
- a_noun | ||
- adjective | ||
- an_adjective | ||
- `noun` | ||
- `nouns` | ||
- `a_noun` | ||
- `adjective` | ||
- `an_adjective` | ||
@@ -138,0 +139,0 @@ |
@@ -7,7 +7,5 @@ /** | ||
import { | ||
nouns, | ||
adjectives, | ||
sentenceTemplates, | ||
phrases | ||
} from './sample' | ||
} from './sample.js' | ||
@@ -20,5 +18,4 @@ import { | ||
pickLastPunc, | ||
pluralize, | ||
normalize | ||
} from './util' | ||
generator | ||
} from './util.js' | ||
@@ -35,3 +32,3 @@ export { | ||
getTemplates | ||
} from './sample' | ||
} from './sample.js' | ||
@@ -43,20 +40,2 @@ const actions = [ | ||
const generator = { | ||
noun: () => { | ||
return rand(nouns) | ||
}, | ||
a_noun: () => { | ||
return normalize(rand(nouns)) | ||
}, | ||
nouns: () => { | ||
return pluralize(rand(nouns)) | ||
}, | ||
adjective: () => { | ||
return rand(adjectives) | ||
}, | ||
an_adjective: () => { | ||
return normalize(rand(adjectives)) | ||
} | ||
} | ||
const trim = (s) => { | ||
@@ -63,0 +42,0 @@ return s.replace(/^[\s\xa0]+|[\s\xa0]+$/g, '') |
@@ -11,3 +11,3 @@ // main.test | ||
const LIMIT = 50 | ||
const LIMIT = 30 | ||
@@ -14,0 +14,0 @@ describe('Test exported methods', () => { |
@@ -11,31 +11,3 @@ // samples | ||
export let 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}}' | ||
'however, {{nouns}} have begun to rent {{nouns}} over the past few months, specifically for {{nouns}} associated with their {{nouns}}' | ||
] | ||
@@ -42,0 +14,0 @@ |
@@ -18,3 +18,3 @@ // sample.test | ||
setTemplates | ||
} from './sample' | ||
} from './sample.js' | ||
@@ -21,0 +21,0 @@ describe('Test nouns/getNouns', () => { |
// utils | ||
import { | ||
vowels | ||
} from './sample' | ||
vowels, | ||
nouns, | ||
adjectives | ||
} from './sample.js' | ||
@@ -51,3 +53,3 @@ let random | ||
let a = 'a' | ||
if (word.match(/^(a|e|i|o)/)) { | ||
if (word.match(/^(a|e|heir|herb|hour|i|o)/)) { | ||
a = 'an' | ||
@@ -57,1 +59,19 @@ } | ||
} | ||
export const generator = { | ||
noun: () => { | ||
return rand(nouns) | ||
}, | ||
a_noun: () => { | ||
return normalize(rand(nouns)) | ||
}, | ||
nouns: () => { | ||
return pluralize(rand(nouns)) | ||
}, | ||
adjective: () => { | ||
return rand(adjectives) | ||
}, | ||
an_adjective: () => { | ||
return normalize(rand(adjectives)) | ||
} | ||
} |
22
149
46382
664