random-strings-gen
v2.0.5
Published
Generator for random strings
Downloads
13
Readme
random-string-names
Generator for random strings.
The problem
You're writing tests and need to come up with the name of your user stub. Why waste
time hard-coding 'John Doe'
again when you could use 'Count Dooku'
or
'Qui-Gon Jinn'
? Using random string characters makes your tests much more interesting.
This solution
This module has ~50 stings and exposes an API for you to get a random one every time you call it.
Installation
This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's dependencies:
npm install --save random-strings-gen
Alternatively you can get the UMD build which is also published to the npm registry and is therefore available via npmcdn.com:
- https://unpkg.com/browse/[email protected]/dist/index.umd.js
- https://unpkg.com/browse/[email protected]/dist/index.umd.min.js
The UMD build exposes the module as a global called gitHubNames
or as an unnamed
module for AMD/CommonJS (require it by its file path)
Usage
const gitHubNames = require('random-strings-gen') // CommonJS
console.log(gitHubNames.random()) // Han Solo
console.log(gitHubNames.random()) // Kit Fisto
// you can also get the full array on `gitHubNames.all`
Inspiration
Other Solutions
This is actually part of a course instructing people how to create open source projects. So as a result there are dozens of copies of this module on npm. Good luck finding the best :-)
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
LICENSE
MIT