https://github.com/sharadbhat/readableurl
An NPM package to generate random readable phrases.
https://github.com/sharadbhat/readableurl
nodejs npm-package random-generation readable-urls
Last synced: about 1 year ago
JSON representation
An NPM package to generate random readable phrases.
- Host: GitHub
- URL: https://github.com/sharadbhat/readableurl
- Owner: sharadbhat
- License: mit
- Created: 2018-06-28T21:40:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T10:46:17.000Z (over 5 years ago)
- Last Synced: 2025-03-18T13:28:04.401Z (about 1 year ago)
- Topics: nodejs, npm-package, random-generation, readable-urls
- Language: JavaScript
- Size: 4.57 MB
- Stars: 20
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# readable-url
An NPM package to generate readable random phrases to add to dynamically generated URLs.
[GitHub repository](https://github.com/sharadbhat/ReadableURL)
To generate readable URLs like Twitch's clips.
Example: https://clips.twitch.tv/WiseAcceptableSnoodPupper
## Get started
To install,
```sh
npm install readable-url
```
## Usage Instructions
To use the package, first require it.
```js
const readable = require("readable-url");
```
Then, we create an object.
```js
// Takes 3 parameters.
// 1. A boolean value - If true, returns string in CamelCase, else lowercase.
// 2. An integer value - The number of words to be generated in the string. (Between 2 and 10).
// 3. A string - The seperator between the words.
var generator = new readable(); // true, 3 and '' are the default values.
// var generator = new readable(false, 5, '-'); // Other options.
```
To generate a random phrase,
```js
var url = generator.generate();
console.log(url); // Prints out 'ForgetfulHarshEgg'
```
This can be used to add to the end of a URL.
Example: https://example.com/photos/ForgetfulHarshEgg
For best results, use an integer value of 3, 4, or 5.