Skip to content

Commit

Permalink
Merge pull request #62 from ndaidong/3.0.3
Browse files Browse the repository at this point in the history
v3.0.3
  • Loading branch information
ndaidong authored Aug 10, 2022
2 parents 0fa4f2a + 0bc9cf2 commit f9814b2
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 44 deletions.
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ import {
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:

Currently, ECMAScript modules work fine on almost all browsers:
Expand All @@ -79,18 +72,18 @@ console.log(window.txtgen.sentence())

## APIs

- .sentence()
- .paragraph([Number totalSentences])
- .article([Number totalParagraphs])
- .addNouns(Array nouns)
- .addAdjectives(Array adjectives)
- .addTemplates(Array sentenceTemplates)
- .setNouns(Array nouns)
- .setAdjectives(Array adjectives)
- .setTemplates(Array sentenceTemplates)
- .getNouns()
- .getAdjectives()
- .getTemplates()
- `.sentence()`
- `.paragraph([Number totalSentences])`
- `.article([Number totalParagraphs])`
- `.addNouns(Array nouns)`
- `.addAdjectives(Array adjectives)`
- `.addTemplates(Array sentenceTemplates)`
- `.setNouns(Array nouns)`
- `.setAdjectives(Array adjectives)`
- `.setTemplates(Array sentenceTemplates)`
- `.getNouns()`
- `.getAdjectives()`
- `.getTemplates()`


As their name suggests, we have 4 groups of methods:
Expand Down
5 changes: 1 addition & 4 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* build.js
* @ndaidong
**/
// build.js

import { readFileSync, writeFileSync } from 'fs'
import { execSync } from 'child_process'
Expand Down
2 changes: 1 addition & 1 deletion dist/cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "txtgen-cjs",
"version": "3.0.2",
"version": "3.0.3",
"main": "./txtgen.js"
}
4 changes: 2 additions & 2 deletions dist/cjs/txtgen.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/txtgen.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/txtgen.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions eval.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
// eval.js
// for human test

import {
sentence
sentence,
paragraph,
article
} from './src/main.js'

console.log('sentence() // => ', sentence())
console.log('Generate sentence ')
console.log('-'.repeat(100))
console.log(sentence())
console.log('-'.repeat(100))

console.log('Generate paragraph ')
console.log('+'.repeat(100))
console.log(paragraph())
console.log('+'.repeat(100))

console.log('Generate article ')
console.log('*'.repeat(100))
console.log(article())
console.log('*'.repeat(100))
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.2",
"version": "3.0.3",
"name": "txtgen",
"description": "Util for generating random sentences, paragraphs and articles in English",
"homepage": "http://ndaidong.github.io/txtgen",
Expand All @@ -8,9 +8,7 @@
"url": "https://github.com/ndaidong/txtgen"
},
"author": "@ndaidong",
"main": "./dist/cjs/txtgen.js",
"module": "./src/main.js",
"browser": "./dist/txtgen.min.js",
"main": "./src/main.js",
"type": "module",
"engines": {
"node": ">= 14"
Expand All @@ -19,7 +17,7 @@
"dtslint": "dtslint types",
"lint": "standard .",
"pretest": "npm run lint",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true --unhandled-rejections=strict --detectOpenHandles --env=jsdom",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --coverage=true --env=jsdom",
"build": "node build.js src/main.js",
"eval": "node eval",
"reset": "node reset"
Expand Down
6 changes: 2 additions & 4 deletions reset.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* reset.js
* @ndaidong
**/
// reset.js
// to clean generated content

import {
existsSync,
Expand Down
5 changes: 1 addition & 4 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* txtgen
* @ndaidong
**/
// main

import {
sentenceTemplates,
Expand Down

0 comments on commit f9814b2

Please sign in to comment.