diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 9b55abe..faa3fc3 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -8,11 +8,11 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: - node_version: [14.x, 16.x, 18.x, 19.x] + node_version: [14.x, 16.x, 18.x, 20.x] steps: - uses: actions/checkout@v2 @@ -24,9 +24,8 @@ jobs: - name: run npm scripts run: | - npm i -g standard npm install - npm run test + npm test - name: sync to coveralls uses: coverallsapp/github-action@v1.1.2 diff --git a/dist/cjs/package.json b/dist/cjs/package.json index 8d0b71e..3149ff3 100644 --- a/dist/cjs/package.json +++ b/dist/cjs/package.json @@ -1,5 +1,5 @@ { "name": "txtgen-cjs", - "version": "3.0.5", + "version": "3.0.6", "main": "./txtgen.js" } \ No newline at end of file diff --git a/dist/cjs/txtgen.js b/dist/cjs/txtgen.js index f0dd827..7e4b1aa 100644 --- a/dist/cjs/txtgen.js +++ b/dist/cjs/txtgen.js @@ -1,4 +1,4 @@ -// txtgen@3.0.5, by @ndaidong - built with esbuild at 2023-03-08T08:35:17.213Z - published under MIT license -var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D(t))!L.call(e,a)&&a!==n&&p(e,a,{get:()=>t[a],enumerable:!(i=P(t,a))||i.enumerable});return e};var F=e=>C(p({},"__esModule",{value:!0}),e);var O={};R(O,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>K,getAdjectives:()=>q,getNouns:()=>j,getTemplates:()=>z,lorem:()=>W,paragraph:()=>$,sentence:()=>_,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});module.exports=F(O);var r=["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"],s=["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"],g=["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, "],d=(e=[],t=[])=>[...new Set([...e,...t])],b=(e=[])=>(r=d(r,e),r.length),v=(e=[])=>(s=d(s,e),s.length),y=(e=[])=>(l=d(l,e),l.length),w=(e=[])=>(r=[...new Set([...e])],r.length),x=(e=[])=>(s=[...new Set([...e])],s.length),k=(e=[])=>(l=[...new Set([...e])],l.length),j=()=>[...r],q=()=>[...s],z=()=>[...l];var T,h=e=>{T=e};h(Math.random);var m=()=>T(),c=(e,t)=>{let n=e,i=t-e+1;return Math.floor(m()*i)+n},o=e=>{let t;for(;!t;)t=e[c(0,e.length-1)];return t},S=()=>{let e=".......!?!?;...".split("");return o(e)},U=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!g.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),A=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},N={noun:()=>o(r),a_noun:()=>A(o(r)),nouns:()=>U(o(r)),adjective:()=>o(s),an_adjective:()=>A(o(s))};var M="a ac accumsan adipiscing aenean aliqua aliquam aliquet amet arcu at auctor augue bibendum blandit commodo condimentum consectetur consequat convallis cras cum curabitur cursus dapibus diam dictum dictumst dignissim dis do dolor dolore donec dui duis egestas eget eiusmod elementum elit enim erat eros est et etiam eu euismod facilisis faucibus felis fermentum feugiat fringilla gravida habitant habitasse hac hendrerit iaculis id imperdiet in incididunt integer ipsum justo labore lacinia lacus laoreet lectus leo libero lobortis lorem magna magnis massa mattis mauris mi molestie montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non nulla nullam nunc odio orci ornare parturient pellentesque penatibus pharetra phasellus placerat platea porta porttitor praesent pretium proin pulvinar purus quam quis quisque ridiculus risus sagittis scelerisque sed sem semper senectus sit sociis sodales sollicitudin suscipit suspendisse tellus tempor tempus tincidunt tortor tristique turpis ullamcorper ultrices ultricies urna ut varius vel velit venenatis vestibulum vitae viverra volutpat".split(" "),B=M.length,W=(e=2,t=24)=>{let n=c(e,t),i=[];for(;i.lengthe.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),H=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let i=0;im()<.33?o(f):"",J=()=>H(o(l));var _=()=>{let t=I()+J();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=S(),t},$=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D(t))!L.call(e,a)&&a!==n&&p(e,a,{get:()=>t[a],enumerable:!(i=P(t,a))||i.enumerable});return e};var F=e=>C(p({},"__esModule",{value:!0}),e);var O={};R(O,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>K,getAdjectives:()=>q,getNouns:()=>j,getTemplates:()=>z,lorem:()=>W,paragraph:()=>$,sentence:()=>_,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});module.exports=F(O);var r=["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"],s=["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"],g=["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, "],d=(e=[],t=[])=>[...new Set([...e,...t])],b=(e=[])=>(r=d(r,e),r.length),v=(e=[])=>(s=d(s,e),s.length),y=(e=[])=>(l=d(l,e),l.length),w=(e=[])=>(r=[...new Set([...e])],r.length),x=(e=[])=>(s=[...new Set([...e])],s.length),k=(e=[])=>(l=[...new Set([...e])],l.length),j=()=>[...r],q=()=>[...s],z=()=>[...l];var T,h=e=>{T=e};h(Math.random);var m=()=>T(),c=(e,t)=>{let n=e,i=t-e+1;return Math.floor(m()*i)+n},o=e=>{let t;for(;!t;)t=e[c(0,e.length-1)];return t},S=()=>{let e=".......!?!?;...".split("");return o(e)},U=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!g.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),A=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},N={noun:()=>o(r),a_noun:()=>A(o(r)),nouns:()=>U(o(r)),adjective:()=>o(s),an_adjective:()=>A(o(s))};var M="a ac accumsan adipiscing aenean aliqua aliquam aliquet amet arcu at auctor augue bibendum blandit commodo condimentum consectetur consequat convallis cras cum curabitur cursus dapibus diam dictum dictumst dignissim dis do dolor dolore donec dui duis egestas eget eiusmod elementum elit enim erat eros est et etiam eu euismod facilisis faucibus felis fermentum feugiat fringilla gravida habitant habitasse hac hendrerit iaculis id imperdiet in incididunt integer ipsum justo labore lacinia lacus laoreet lectus leo libero lobortis lorem magna magnis massa mattis mauris mi molestie montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non nulla nullam nunc odio orci ornare parturient pellentesque penatibus pharetra phasellus placerat platea porta porttitor praesent pretium proin pulvinar purus quam quis quisque ridiculus risus sagittis scelerisque sed sem semper senectus sit sociis sodales sollicitudin suscipit suspendisse tellus tempor tempus tincidunt tortor tristique turpis ullamcorper ultrices ultricies urna ut varius vel velit venenatis vestibulum vitae viverra volutpat".split(" "),B=M.length,W=(e=2,t=24)=>{let n=c(e,t),i=[];for(;i.lengthe.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),H=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let i=0;im()<.33?o(f):"",J=()=>H(o(l));var _=(e=!1)=>{let n=(e?"":I())+J();return n=n.charAt(0).toUpperCase()+n.slice(1),n+=S(),n},$=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length[...new Set([...e,...t])],x=(e=[])=>(a=p(a,e),a.length),k=(e=[])=>(r=p(r,e),r.length),j=(e=[])=>(o=p(o,e),o.length),q=(e=[])=>(a=[...new Set([...e])],a.length),z=(e=[])=>(r=[...new Set([...e])],r.length),A=(e=[])=>(o=[...new Set([...e])],o.length),T=()=>[...a],S=()=>[...r],N=()=>[...o];var f,b=e=>{f=e};b(Math.random);var d=()=>f(),l=(e,t)=>{let n=e,i=t-e+1;return Math.floor(d()*i)+n},s=e=>{let t;for(;!t;)t=e[l(0,e.length-1)];return t},v=()=>{let e=".......!?!?;...".split("");return s(e)},M=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!h.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),g=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},y={noun:()=>s(a),a_noun:()=>g(s(a)),nouns:()=>M(s(a)),adjective:()=>s(r),an_adjective:()=>g(s(r))};var w="a ac accumsan adipiscing aenean aliqua aliquam aliquet amet arcu at auctor augue bibendum blandit commodo condimentum consectetur consequat convallis cras cum curabitur cursus dapibus diam dictum dictumst dignissim dis do dolor dolore donec dui duis egestas eget eiusmod elementum elit enim erat eros est et etiam eu euismod facilisis faucibus felis fermentum feugiat fringilla gravida habitant habitasse hac hendrerit iaculis id imperdiet in incididunt integer ipsum justo labore lacinia lacus laoreet lectus leo libero lobortis lorem magna magnis massa mattis mauris mi molestie montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non nulla nullam nunc odio orci ornare parturient pellentesque penatibus pharetra phasellus placerat platea porta porttitor praesent pretium proin pulvinar purus quam quis quisque ridiculus risus sagittis scelerisque sed sem semper senectus sit sociis sodales sollicitudin suscipit suspendisse tellus tempor tempus tincidunt tortor tristique turpis ullamcorper ultrices ultricies urna ut varius vel velit venenatis vestibulum vitae viverra volutpat".split(" "),W=w.length,_=(e=2,t=24)=>{let n=l(e,t),i=[];for(;i.lengthe.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),D=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let i=0;id()<.33?s(m):"",R=()=>D(s(o));var C=()=>{let t=L()+R();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=v(),t},F=(e=0)=>{e||(e=l(3,10));let t=Math.min(e,15),n=[];for(;n.length{e||(e=l(3,10));let t=Math.min(e,15),n=[];for(;n.length[...new Set([...e,...n])],x=(e=[])=>(a=p(a,e),a.length),k=(e=[])=>(r=p(r,e),r.length),j=(e=[])=>(o=p(o,e),o.length),q=(e=[])=>(a=[...new Set([...e])],a.length),z=(e=[])=>(r=[...new Set([...e])],r.length),A=(e=[])=>(o=[...new Set([...e])],o.length),T=()=>[...a],S=()=>[...r],N=()=>[...o];var f,b=e=>{f=e};b(Math.random);var d=()=>f(),l=(e,n)=>{let t=e,i=n-e+1;return Math.floor(d()*i)+t},s=e=>{let n;for(;!n;)n=e[l(0,e.length-1)];return n},v=()=>{let e=".......!?!?;...".split("");return s(e)},M=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!h.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),g=e=>{let n="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(n="an"),`${n} ${e}`},y={noun:()=>s(a),a_noun:()=>g(s(a)),nouns:()=>M(s(a)),adjective:()=>s(r),an_adjective:()=>g(s(r))};var w="a ac accumsan adipiscing aenean aliqua aliquam aliquet amet arcu at auctor augue bibendum blandit commodo condimentum consectetur consequat convallis cras cum curabitur cursus dapibus diam dictum dictumst dignissim dis do dolor dolore donec dui duis egestas eget eiusmod elementum elit enim erat eros est et etiam eu euismod facilisis faucibus felis fermentum feugiat fringilla gravida habitant habitasse hac hendrerit iaculis id imperdiet in incididunt integer ipsum justo labore lacinia lacus laoreet lectus leo libero lobortis lorem magna magnis massa mattis mauris mi molestie montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non nulla nullam nunc odio orci ornare parturient pellentesque penatibus pharetra phasellus placerat platea porta porttitor praesent pretium proin pulvinar purus quam quis quisque ridiculus risus sagittis scelerisque sed sem semper senectus sit sociis sodales sollicitudin suscipit suspendisse tellus tempor tempus tincidunt tortor tristique turpis ullamcorper ultrices ultricies urna ut varius vel velit venenatis vestibulum vitae viverra volutpat".split(" "),W=w.length,_=(e=2,n=24)=>{let t=l(e,n),i=[];for(;i.lengthe.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),D=e=>{let n=e,t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(let i=0;id()<.33?s(m):"",R=()=>D(s(o));var C=(e=!1)=>{let t=(e?"":L())+R();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=v(),t},F=(e=0)=>{e||(e=l(3,10));let n=Math.min(e,15),t=[];for(;t.length{e||(e=l(3,10));let n=Math.min(e,15),t=[];for(;t.length{var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D(t))!L.call(e,a)&&a!==n&&p(e,a,{get:()=>t[a],enumerable:!(i=P(t,a))||i.enumerable});return e};var F=e=>C(p({},"__esModule",{value:!0}),e);var O={};R(O,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>K,getAdjectives:()=>q,getNouns:()=>j,getTemplates:()=>z,lorem:()=>W,paragraph:()=>$,sentence:()=>_,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});var r=["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"],s=["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"],g=["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, "],d=(e=[],t=[])=>[...new Set([...e,...t])],b=(e=[])=>(r=d(r,e),r.length),v=(e=[])=>(s=d(s,e),s.length),y=(e=[])=>(l=d(l,e),l.length),w=(e=[])=>(r=[...new Set([...e])],r.length),x=(e=[])=>(s=[...new Set([...e])],s.length),k=(e=[])=>(l=[...new Set([...e])],l.length),j=()=>[...r],q=()=>[...s],z=()=>[...l];var T,h=e=>{T=e};h(Math.random);var m=()=>T(),c=(e,t)=>{let n=e,i=t-e+1;return Math.floor(m()*i)+n},o=e=>{let t;for(;!t;)t=e[c(0,e.length-1)];return t},S=()=>{let e=".......!?!?;...".split("");return o(e)},U=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!g.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),A=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},N={noun:()=>o(r),a_noun:()=>A(o(r)),nouns:()=>U(o(r)),adjective:()=>o(s),an_adjective:()=>A(o(s))};var M="a ac accumsan adipiscing aenean aliqua aliquam aliquet amet arcu at auctor augue bibendum blandit commodo condimentum consectetur consequat convallis cras cum curabitur cursus dapibus diam dictum dictumst dignissim dis do dolor dolore donec dui duis egestas eget eiusmod elementum elit enim erat eros est et etiam eu euismod facilisis faucibus felis fermentum feugiat fringilla gravida habitant habitasse hac hendrerit iaculis id imperdiet in incididunt integer ipsum justo labore lacinia lacus laoreet lectus leo libero lobortis lorem magna magnis massa mattis mauris mi molestie montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non nulla nullam nunc odio orci ornare parturient pellentesque penatibus pharetra phasellus placerat platea porta porttitor praesent pretium proin pulvinar purus quam quis quisque ridiculus risus sagittis scelerisque sed sem semper senectus sit sociis sodales sollicitudin suscipit suspendisse tellus tempor tempus tincidunt tortor tristique turpis ullamcorper ultrices ultricies urna ut varius vel velit venenatis vestibulum vitae viverra volutpat".split(" "),B=M.length,W=(e=2,t=24)=>{let n=c(e,t),i=[];for(;i.lengthe.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),H=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let i=0;im()<.33?o(f):"",J=()=>H(o(l));var _=()=>{let t=I()+J();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=S(),t},$=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length{var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D(t))!L.call(e,a)&&a!==n&&p(e,a,{get:()=>t[a],enumerable:!(i=P(t,a))||i.enumerable});return e};var F=e=>C(p({},"__esModule",{value:!0}),e);var O={};R(O,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>K,getAdjectives:()=>q,getNouns:()=>j,getTemplates:()=>z,lorem:()=>W,paragraph:()=>$,sentence:()=>_,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});var r=["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"],s=["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"],g=["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, "],d=(e=[],t=[])=>[...new Set([...e,...t])],b=(e=[])=>(r=d(r,e),r.length),v=(e=[])=>(s=d(s,e),s.length),y=(e=[])=>(l=d(l,e),l.length),w=(e=[])=>(r=[...new Set([...e])],r.length),x=(e=[])=>(s=[...new Set([...e])],s.length),k=(e=[])=>(l=[...new Set([...e])],l.length),j=()=>[...r],q=()=>[...s],z=()=>[...l];var T,h=e=>{T=e};h(Math.random);var m=()=>T(),c=(e,t)=>{let n=e,i=t-e+1;return Math.floor(m()*i)+n},o=e=>{let t;for(;!t;)t=e[c(0,e.length-1)];return t},S=()=>{let e=".......!?!?;...".split("");return o(e)},U=e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!g.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"),A=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},N={noun:()=>o(r),a_noun:()=>A(o(r)),nouns:()=>U(o(r)),adjective:()=>o(s),an_adjective:()=>A(o(s))};var M="a ac accumsan adipiscing aenean aliqua aliquam aliquet amet arcu at auctor augue bibendum blandit commodo condimentum consectetur consequat convallis cras cum curabitur cursus dapibus diam dictum dictumst dignissim dis do dolor dolore donec dui duis egestas eget eiusmod elementum elit enim erat eros est et etiam eu euismod facilisis faucibus felis fermentum feugiat fringilla gravida habitant habitasse hac hendrerit iaculis id imperdiet in incididunt integer ipsum justo labore lacinia lacus laoreet lectus leo libero lobortis lorem magna magnis massa mattis mauris mi molestie montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non nulla nullam nunc odio orci ornare parturient pellentesque penatibus pharetra phasellus placerat platea porta porttitor praesent pretium proin pulvinar purus quam quis quisque ridiculus risus sagittis scelerisque sed sem semper senectus sit sociis sodales sollicitudin suscipit suspendisse tellus tempor tempus tincidunt tortor tristique turpis ullamcorper ultrices ultricies urna ut varius vel velit venenatis vestibulum vitae viverra volutpat".split(" "),B=M.length,W=(e=2,t=24)=>{let n=c(e,t),i=[];for(;i.lengthe.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),H=e=>{let t=e,n=e.match(/\{\{(.+?)\}\}/g);if(n&&n.length)for(let i=0;im()<.33?o(f):"",J=()=>H(o(l));var _=(e=!1)=>{let n=(e?"":I())+J();return n=n.charAt(0).toUpperCase()+n.slice(1),n+=S(),n},$=(e=0)=>{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length{e||(e=c(3,10));let t=Math.min(e,15),n=[];for(;n.length { - const phrase = randomStartingPhrase() +export const sentence = (ignoreStartingPhrase = false) => { + const phrase = ignoreStartingPhrase ? '' : randomStartingPhrase() let s = phrase + makeSentenceFromTemplate() s = s.charAt(0).toUpperCase() + s.slice(1) s += pickLastPunc() diff --git a/src/main.test.js b/src/main.test.js index ac6bc74..245760c 100644 --- a/src/main.test.js +++ b/src/main.test.js @@ -18,6 +18,12 @@ describe('Test exported methods', () => { expect(val.split(' ').length).toBeGreaterThan(3) } }) + test(' test if .sentence() works correctly with ignoreStartingPhrase flag', () => { + for (let i = 0; i < LIMIT; i++) { + const val = sentence(true) + expect(val.split(' ').length).toBeGreaterThan(3) + } + }) test(' test if .paragraph() works correctly', () => { for (let i = 0; i < LIMIT; i++) { const val = paragraph(5) diff --git a/types/index.d.ts b/types/index.d.ts index 628aab5..ef89550 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,3 +13,5 @@ export function setTemplates(ls?: string[]): number; export function getNouns(): string[]; export function getAdjectives(): string[]; export function getTemplates(): string[]; + +export function lorem(min?: number, max?: number): string; diff --git a/types/test.ts b/types/test.ts index 9a883c3..94f88a3 100644 --- a/types/test.ts +++ b/types/test.ts @@ -23,3 +23,5 @@ txtgen.setTemplates(['tml1', 'tml2']); // $ExpectType number txtgen.getNouns(); // $ExpectType string[] txtgen.getAdjectives(); // $ExpectType string[] txtgen.getTemplates(); // $ExpectType string[] + +txtgen.lorem(1); // $ExpectType string