Skip to content

Commit

Permalink
Merge 5a363bf into 629c7fe
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaidong committed Jan 7, 2022
2 parents 629c7fe + 5a363bf commit 2693ef4
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 89 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Lightweight util for generating random sentences, paragraphs and articles in Eng

# Demo

[See how it works?](http://ndaidong.github.io/txtgen/)
[See how it works?](https://ndaidong.github.io/txtgen/)


## Setup
Expand Down Expand Up @@ -38,22 +38,23 @@ Lightweight util for generating random sentences, paragraphs and articles in Eng

### Node.js:

Sync v14, ECMAScript modules [have became the official standard format](https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_modules_ecmascript_modules).

Just [enable](https://nodejs.org/api/packages.html#determining-module-system) and enjoy with ES6 import/export syntax.
```js
import {
sentence
} from 'txtgen'

// 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:

Expand Down Expand Up @@ -126,11 +127,11 @@ addTemplates(templates)

Here are the available placeholders:

- noun
- nouns
- a_noun
- adjective
- an_adjective
- `noun`
- `nouns`
- `a_noun`
- `adjective`
- `an_adjective`


## Test
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.0rc1",
"version": "3.0.1",
"main": "./txtgen.js"
}
6 changes: 3 additions & 3 deletions dist/cjs/txtgen.js

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

0 comments on commit 2693ef4

Please sign in to comment.