From 075da1f691d516a74723bbe81d67573c67574dc5 Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 8 Mar 2023 15:35:41 +0700 Subject: [PATCH 1/2] v3.0.5 - Add `lorem()` method - Change coding style (remove standardjs) - Update dependencies --- .eslintignore | 2 + .eslintrc.json | 118 ++++++++++++++++++++++++++++++++++++++++++ .npmignore | 5 ++ README.md | 26 ++++++++-- build.js | 18 +++---- cjs-eval.js | 2 +- dist/cjs/package.json | 2 +- dist/cjs/txtgen.js | 6 +-- dist/txtgen.esm.js | 6 +-- dist/txtgen.min.js | 6 +-- eval.js | 8 ++- package.json | 21 ++++---- reset.js | 4 +- src/lorem.js | 22 ++++++++ src/main.js | 6 ++- src/main.test.js | 12 ++++- src/sample.js | 8 +-- src/util.js | 2 +- 18 files changed, 228 insertions(+), 46 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 .npmignore create mode 100644 src/lorem.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f06235c --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules +dist diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..c9e0a63 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,118 @@ +{ + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "env": { + "es6": true, + "node": true, + "jest": true + }, + "globals": {}, + "plugins": [], + "overrides": [], + "extends": ["eslint:recommended"], + "rules": { + "arrow-spacing": ["error", { "before": true, "after": true }], + "block-spacing": ["error", "always"], + "brace-style": ["error", "1tbs", { "allowSingleLine": true }], + "camelcase": ["error", { + "allow": ["^UNSAFE_"], + "properties": "never", + "ignoreGlobals": true + }], + "comma-dangle": ["error", { + "arrays": "always-multiline", + "objects": "always-multiline", + "imports": "never", + "exports": "never", + "functions": "never" + }], + "comma-spacing": ["error", { "before": false, "after": true }], + "eol-last": "error", + "eqeqeq": ["error", "always", { "null": "ignore" }], + "func-call-spacing": ["error", "never"], + "indent": [ + "error", + 2, + { + "MemberExpression": 1, + "FunctionDeclaration": { + "body": 1, + "parameters": 2 + }, + "SwitchCase": 1 + } + ], + "key-spacing": ["error", { "beforeColon": false, "afterColon": true }], + "keyword-spacing": ["error", { "before": true, "after": true }], + "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], + "max-len": [ + "error", + { + "code": 120, + "ignoreTrailingComments": true, + "ignoreComments": true, + "ignoreUrls": true + } + ], + "max-lines": [ + "error", + { + "max": 360, + "skipBlankLines": true, + "skipComments": false + } + ], + "max-lines-per-function": [ + "error", + { + "max": 250, + "skipBlankLines": true + } + ], + "max-params": ["error", 3], + "no-array-constructor": "error", + "no-mixed-spaces-and-tabs": "error", + "no-multi-spaces": "error", + "no-multi-str": "error", + "no-multiple-empty-lines": [ + "error", + { + "max": 1, + "maxEOF": 0 + } + ], + "no-restricted-syntax": [ + "error", + "WithStatement", + "BinaryExpression[operator='in']" + ], + "no-trailing-spaces": "error", + "no-use-before-define": [ + "error", + { + "functions": true, + "classes": true, + "variables": false + } + ], + "no-var": "warn", + "object-curly-spacing": ["error", "always"], + "padded-blocks": [ + "error", + { + "blocks": "never", + "switches": "never", + "classes": "never" + } + ], + "quotes": ["error", "single"], + "space-before-blocks": ["error", "always"], + "space-before-function-paren": ["error", "always"], + "space-infix-ops": "error", + "space-unary-ops": ["error", { "words": true, "nonwords": false }], + "space-in-parens": ["error", "never"], + "semi": ["error", "never"] + } +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..cd99c2e --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +node_modules +coverage +.github +pnpm-lock.yaml +examples diff --git a/README.md b/README.md index fa80c6b..dcb3a57 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,10 @@ Lightweight util for generating random sentences, paragraphs and articles in Eng [![CI test](https://github.com/ndaidong/txtgen/workflows/ci-test/badge.svg)](https://github.com/ndaidong/txtgen/actions) [![Coverage Status](https://coveralls.io/repos/github/ndaidong/txtgen/badge.svg)](https://coveralls.io/github/ndaidong/txtgen) ![CodeQL](https://github.com/ndaidong/txtgen/workflows/CodeQL/badge.svg) -[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) - -[![Deploy](https://button.deta.dev/1/svg)](https://go.deta.dev/deploy?repo=https://github.com/ndaidong/txtgen-deta) # Demo - [Want to see how it works?](https://ndaidong.github.io/txtgen/) -- [Deta service to generate text](https://txtgen.deta.dev/) ## Setup @@ -85,6 +81,7 @@ console.log(window.txtgen.sentence()) - `.getNouns()` - `.getAdjectives()` - `.getTemplates()` + - `.lorem([Number min [, Number max]])` As their name suggests, we have 4 groups of methods: @@ -97,13 +94,13 @@ As their name suggests, we have 4 groups of methods: The `set*` and `get*` methods were added in v2.2.3 to help you customize your sample data. +In addition, we've added `lorem()` method since v3.0.5 to generate lorem ipsum text. ### Template If you want to add more kinds of sentences, just use the `.addTemplates()` method; it expects a list of sentence templates. Each sentence template is an English sentence, containing placeholders that can be replaced with any alternative word. - For example: ```js @@ -128,6 +125,25 @@ Here are the available placeholders: - `an_adjective` +### Lorem ipsum + +Syntax: + +```js +lorem() // generate a random phrase with length from 2 to 24 words of lorem ipsum +lorem(Number min) // set the minimum number of words +lorem(Number min, Number max)// set the minimum/maximum number of words +``` + +Example: + +```js +import { lorem } from 'txtgen' + +const phrase = lorem() +console.log(phrase) // => nisi blandit feugiat tempus imperdiet etiam eu mus augue +``` + ## Test ```bash diff --git a/build.js b/build.js index 232ca02..32b945b 100644 --- a/build.js +++ b/build.js @@ -15,7 +15,7 @@ const buildTime = (new Date()).toISOString() const shortComment = [ `// ${pkg.name}@${pkg.version}, by ${pkg.author}`, `built with esbuild at ${buildTime}`, - `published under ${pkg.license} license` + `published under ${pkg.license} license`, ].join(' - ') const baseOpt = { @@ -24,7 +24,7 @@ const baseOpt = { charset: 'utf8', target: ['es2020', 'node14'], minify: true, - write: true + write: true, } const esmVersion = { @@ -34,8 +34,8 @@ const esmVersion = { mainFields: ['module'], outfile: `dist/${pkg.name}.esm.js`, banner: { - js: shortComment - } + js: shortComment, + }, } buildSync(esmVersion) @@ -46,15 +46,15 @@ const cjsVersion = { mainFields: ['main'], outfile: `dist/cjs/${pkg.name}.js`, banner: { - js: shortComment - } + js: shortComment, + }, } buildSync(cjsVersion) const cjspkg = { name: pkg.name + '-cjs', version: pkg.version, - main: `./${pkg.name}.js` + main: `./${pkg.name}.js`, } writeFileSync( 'dist/cjs/package.json', @@ -71,7 +71,7 @@ const iifeVersion = { globalName: pkg.name, outfile: `dist/${pkg.name}.min.js`, banner: { - js: shortComment - } + js: shortComment, + }, } buildSync(iifeVersion) diff --git a/cjs-eval.js b/cjs-eval.js index 59f58e6..d7d7cab 100644 --- a/cjs-eval.js +++ b/cjs-eval.js @@ -2,7 +2,7 @@ // remove type=`module` from package.json first const { - sentence + sentence, } = require('./dist/cjs/txtgen.js') console.log('sentence() // => ', sentence()) diff --git a/dist/cjs/package.json b/dist/cjs/package.json index 1f589d7..8d0b71e 100644 --- a/dist/cjs/package.json +++ b/dist/cjs/package.json @@ -1,5 +1,5 @@ { "name": "txtgen-cjs", - "version": "3.0.4", + "version": "3.0.5", "main": "./txtgen.js" } \ No newline at end of file diff --git a/dist/cjs/txtgen.js b/dist/cjs/txtgen.js index 207a402..f0dd827 100644 --- a/dist/cjs/txtgen.js +++ b/dist/cjs/txtgen.js @@ -1,4 +1,4 @@ -// txtgen@3.0.4, by @ndaidong - built with esbuild at 2022-08-20T15:11:38.588Z - published under MIT license -var u=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},W=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!L.call(e,o)&&o!==n&&u(e,o,{get:()=>t[o],enumerable:!(r=$(t,o))||r.enumerable});return e};var C=e=>W(u({},"__esModule",{value:!0}),e);var I={};R(I,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>H,getAdjectives:()=>z,getNouns:()=>j,getTemplates:()=>A,paragraph:()=>_,sentence:()=>M,setAdjectives:()=>x,setNouns:()=>w,setRandom:()=>h,setTemplates:()=>k});module.exports=C(I);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 N,h=e=>{N=e};h(Math.random);var d=()=>N(),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},S=()=>{let e=".......!?!?;...".split("");return s(e)},F=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"),T=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},q={noun:()=>s(a),a_noun:()=>T(s(a)),nouns:()=>F(s(a)),adjective:()=>s(i),an_adjective:()=>T(s(i))};var U=["noun","a_noun","nouns","adjective","an_adjective"],B=e=>e.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 r=0;rd()<.33?s(f):"",G=()=>D(s(l));var M=()=>{let t=E()+G();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 _=()=>{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[...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 f,b=e=>{f=e};b(Math.random);var u=()=>f(),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},v=()=>{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"),m=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},y={noun:()=>s(a),a_noun:()=>m(s(a)),nouns:()=>q(s(a)),adjective:()=>s(i),an_adjective:()=>m(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;ru()<.33?s(g):"",L=()=>$(s(o));var R=()=>{let t=P()+L();return t=t.charAt(0).toUpperCase()+t.slice(1),t+=v(),t},W=(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,...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{var u=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},W=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!L.call(e,o)&&o!==n&&u(e,o,{get:()=>t[o],enumerable:!(r=$(t,o))||r.enumerable});return e};var C=e=>W(u({},"__esModule",{value:!0}),e);var I={};R(I,{addAdjectives:()=>v,addNouns:()=>b,addTemplates:()=>y,article:()=>H,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 N,h=e=>{N=e};h(Math.random);var d=()=>N(),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},S=()=>{let e=".......!?!?;...".split("");return s(e)},F=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"),T=e=>{let t="a";return e.match(/^(a|e|heir|herb|hour|i|o)/)&&(t="an"),`${t} ${e}`},q={noun:()=>s(a),a_noun:()=>T(s(a)),nouns:()=>F(s(a)),adjective:()=>s(i),an_adjective:()=>T(s(i))};var U=["noun","a_noun","nouns","adjective","an_adjective"],B=e=>e.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 r=0;rd()<.33?s(f):"",G=()=>D(s(l));var M=()=>{let t=E()+G();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 _=()=>{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 { diff --git a/src/lorem.js b/src/lorem.js new file mode 100644 index 0000000..bf184d0 --- /dev/null +++ b/src/lorem.js @@ -0,0 +1,22 @@ +// lorem.js + +import { randint } from './util.js' + +const WordDict = '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(' ') // eslint-disable-line + +const WordDictSize = WordDict.length + +export const generate = (min = 2, max = 24) => { + const size = randint(min, max) + const words = [] + + while (words.length < size) { + const r = randint(0, WordDictSize) + const w = WordDict[r] + if (w && !words.includes(w)) { + words.push(w) + } + } + + return words.join(' ') +} diff --git a/src/main.js b/src/main.js index 871765a..4d02e38 100755 --- a/src/main.js +++ b/src/main.js @@ -14,6 +14,10 @@ import { generator } from './util.js' +export { + generate as lorem +} from './lorem.js' + export { addNouns, addAdjectives, @@ -28,7 +32,7 @@ export { const actions = [ 'noun', 'a_noun', 'nouns', - 'adjective', 'an_adjective' + 'adjective', 'an_adjective', ] const trim = (s) => { diff --git a/src/main.test.js b/src/main.test.js index 6cbda55..ac6bc74 100644 --- a/src/main.test.js +++ b/src/main.test.js @@ -5,7 +5,8 @@ import { sentence, paragraph, - article + article, + lorem } from './main.js' const LIMIT = 30 @@ -36,3 +37,12 @@ describe('Test exported methods', () => { } }) }) + +describe('Test lorem generation', () => { + test(' test if lorem() works correctly', () => { + for (let i = 0; i < LIMIT; i++) { + const val = lorem(4, 10) + expect(val.split(' ').length).toBeGreaterThan(3) + } + }) +}) diff --git a/src/sample.js b/src/sample.js index a2572ea..cab425c 100644 --- a/src/sample.js +++ b/src/sample.js @@ -1,14 +1,16 @@ // samples +/* eslint-disable */ + export let 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'] export let 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'] export const vowels = [ - 'a', 'e', 'i', 'o', 'u', 'y' + 'a', 'e', 'i', 'o', 'u', 'y', ] export let sentenceTemplates = [ - 'however, {{nouns}} have begun to rent {{nouns}} over the past few months, specifically for {{nouns}} associated with their {{nouns}}' + 'however, {{nouns}} have begun to rent {{nouns}} over the past few months, specifically for {{nouns}} associated with their {{nouns}}', ] export const phrases = [ @@ -42,7 +44,7 @@ export const phrases = [ 'after a long day at school and work, ', 'waking to the buzz of the alarm clock, ', 'draped neatly on a hanger, ', - 'shouting with happiness, ' + 'shouting with happiness, ', ] const mergeArray = (a = [], b = []) => { diff --git a/src/util.js b/src/util.js index dd4d53b..4100b79 100644 --- a/src/util.js +++ b/src/util.js @@ -71,5 +71,5 @@ export const generator = { }, an_adjective: () => { return normalize(rand(adjectives)) - } + }, } From fe261ead163b94e00c9eedf9227b3e0ff6eb8105 Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 8 Mar 2023 15:37:21 +0700 Subject: [PATCH 2/2] Update CI config --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 560615d..9b55abe 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node_version: [14.x, 15.x, 16.x, 17.x, 18.x] + node_version: [14.x, 16.x, 18.x, 19.x] steps: - uses: actions/checkout@v2