1.1.2 • Published 4 years ago
readable-url-names v1.1.2
readable-url-names
An NPM package to generate readable random phrases to add to dynamically generated URLs.
To generate readable URLs like Twitch's clips.
Example: https://clips.twitch.tv/WiseAcceptableSnoodPupper
This project is forked from:
It adds support for usage in browsers (using tools like webpack and browserify) and removes the need to read word files at runtime.
Get started
To install,
npm install readable-url-names
Usage Instructions
To use the package, first require it.
const readable = require("readable-url-names");
Then, we create an object.
// 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,
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.