Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wearerobos/random-text-parser
Generate dynamic text by randomizing sentences between parenthesis and separated by pipes :page_facing_up:
https://github.com/wearerobos/random-text-parser
nodejs oss random-generation random-sentences text-renderer
Last synced: about 1 month ago
JSON representation
Generate dynamic text by randomizing sentences between parenthesis and separated by pipes :page_facing_up:
- Host: GitHub
- URL: https://github.com/wearerobos/random-text-parser
- Owner: wearerobos
- License: mit
- Created: 2017-03-27T17:55:37.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-27T20:00:24.000Z (over 6 years ago)
- Last Synced: 2024-09-21T09:04:42.035Z (3 months ago)
- Topics: nodejs, oss, random-generation, random-sentences, text-renderer
- Language: JavaScript
- Size: 19.5 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Random Text Parser :memo:
Generate random text by randomizing sentences between parenthesis separated by pipe.
## Example
`randomTextParser("I (don't|do|really) mind if you do this ((even if it hurts|bacause it may hurt) me)");`
Returns random sentence:
> I don't mind if you do this (bacause it may hurt me)
>
> I do mind if you do this (bacause it may hurt me)
>
> I really mind if you do this (even if it hurts me)
>
> I really mind if you do this (even if it hurts me)
>
> ...# Installation
`npm install @wearerobos/random-text-parser --save`## Usage
Just create your text with the random part between (parenthesis) and separated by |pipes| and pass it as first parameter to Random Text Parser.
You may even have nested "random objects".
```
const randomTextParser = require('@wearerobos/random-text-parser');
randomTextParser("I ((don't|do|really) mind|will (kill|hug|look for) you)|make you mine) if you do this.")
```## Contributing
Hope you enjoy this and contribute!We are using ES5 syntax for better compatibility.
Please, test your pull requests. We are using Mocha and Chai for testing.
Any doubt, feel free to ask.