Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/francisfuzz/str-gen
Utility package that generates a variety of random strings based on a specified charset
https://github.com/francisfuzz/str-gen
javascript javascript-library random-string-generators
Last synced: about 8 hours ago
JSON representation
Utility package that generates a variety of random strings based on a specified charset
- Host: GitHub
- URL: https://github.com/francisfuzz/str-gen
- Owner: francisfuzz
- License: other
- Created: 2021-08-11T00:38:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-11T22:11:22.000Z (over 3 years ago)
- Last Synced: 2024-08-10T09:32:13.052Z (3 months ago)
- Topics: javascript, javascript-library, random-string-generators
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@francisfuzz/str-gen
- Size: 48.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# str-gen
[![Node.js CI](https://github.com/francisfuzz/str-gen/actions/workflows/node.js.yml/badge.svg)](https://github.com/francisfuzz/str-gen/actions/workflows/node.js.yml)
"str-gen", short for "string generator". This is a utility package that generates a variety of random strings.
## Usage
First, assuming that NPM is installed on your machine, create a new directory, navigate to it, and install the package using a command line interface (CLI) of your choice:
```shell
mkdir example-project
cd example-project
npm install @francisfuzz/str-gen
```Then, create a file, say `example.js` and run it in your CLI as `node example.js`:
```js
const generate = require('@francisfuzz/str-gen')
const SIMPLE_CHARSET = ['s', 'i', 'm', 'p', 'l', 'e']console.log(generate(10, SIMPLE_CHARSET)) // => 'lsmsmepssp'
```Check out the [`examples/`](https://github.com/francisfuzz/str-gen/tree/main/examples) directory for more interesting cases.
## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md).