canihazusername/README.md

223 lines
4.2 KiB
Markdown
Raw Normal View History

2021-03-15 18:27:48 +01:00
![logo](https://github.com/cupcakearmy/canihazusername/raw/master/.github/logo.png)
2019-02-09 19:09:04 +01:00
2021-03-15 18:43:00 +01:00
![downloads badge](https://badgen.net/npm/dt/canihazusername)
2020-02-14 14:02:11 +01:00
![types badge](https://badgen.net/npm/types/canihazusername)
![version badge](https://badgen.net/npm/v/canihazusername)
![minzip size badge](https://badgen.net/bundlephobia/minzip/canihazusername)
2020-02-06 10:30:30 +01:00
Username generator. Fully typed, simple and customizable. **0 Dependencies**
2019-02-09 19:13:26 +01:00
2020-02-06 09:59:59 +01:00
The lists are taken from [this repo](https://github.com/imsky/wordlists) and automatically converted into json by `./generate/wordlist.js`
2021-03-15 18:24:00 +01:00
## 🕹 [Interactive Demo](https://canihazusername.vercel.app/)
2020-02-06 10:12:35 +01:00
2020-02-06 10:20:05 +01:00
Small website where you can see it in action and customize the output.
2021-03-15 18:24:00 +01:00
https://canihazusername.vercel.app/
2020-02-06 10:19:38 +01:00
2020-02-06 09:59:59 +01:00
## 🏗 Install
2019-02-09 19:09:04 +01:00
```bash
2020-02-05 22:49:45 +01:00
yarn add canihazusername
2019-02-09 19:09:04 +01:00
```
2020-02-06 09:59:59 +01:00
## 🚀 Quickstart
```typescript
import { generate } from 'canihazusername'
const username = generate()
```
## 🎛 Customize
You can of course customize the generated username. The default format string is `{character}_{english}`.
2019-02-09 19:09:04 +01:00
2020-02-06 09:59:59 +01:00
```typescript
import { generate } from 'canihazusername'
2019-02-09 19:09:04 +01:00
2020-02-06 09:59:59 +01:00
const username = generate('something-{character}_bot')
2020-02-05 22:49:45 +01:00
```
2020-02-06 09:59:59 +01:00
Basically you can use any string you want and everything between `{somelist}` will be replaced from a random word from the list called `somelist`.
There is a [list of available words](#-lists) that you can use.
### ⛓ Combine multiple lists
You can also combine multiple (as many as you wish) lists into the same braket with the `|` charcter.
This will build a combined list and choose at random between all those words.
```typescript
import { generate } from 'canihazusername'
2020-02-06 10:17:14 +01:00
const username = generate('{quantity|age|cats|}')
2020-02-06 09:59:59 +01:00
```
2020-02-06 10:17:14 +01:00
This example will choose a random word between the `quantity`, `age` and `cats` list.
2020-02-07 16:01:34 +01:00
### ✒️ Use you own lists
You can also add your own lists or owerwrite the built in one.
```typescript
import { generate } from 'canihazusername'
const gits = ['gitlab', 'github', 'gitea']
const username = generate('{gits}', { lists: { gits } })
```
### 🔐 Reformats limit
For security reasons the default limit for the maximum reformats/insertions is set to 16.
If you use more than 16 `{}` you can increase them with the `maxReformats` option.
```typescript
import { generate } from 'canihazusername'
const username = generate('{1} {2} ... {17}', { maxReformats: 16 }) // ❌ The last one will not be replaced
const username = generate('{1} {2} ... {17}', { maxReformats: 20 }) // ✅
```
2020-02-06 09:59:59 +01:00
## 🗂 Lists
- age
- algorithms
- appearance
- character
- colors
- complexity
- construction
- corporate_prefixes
- emotions
- geometry
- linguistics
- materials
- music_theory
- physics
- quantity
- shape
- size
- sound
- speed
- taste
- temperature
- weather
- blockchain
- corporate
- hipster
- lorem
- reddit
- alpha
- canada
- city_states
- france
- netherlands
- switzerland
- united_states
- apple
- intel
- microsoft
- unicorns
- founders
- usa
- chicago
- newyork
- basque
- english
- french
- german
- irish
- italian
- scottish
- 3d_graphics
- 3d_printing
- accounting
- apex_predators
- architecture
- astronomy
- automobiles
- birds
- buildings
- car_parts
- cats
- cheese
- chemistry
- coding
- condiments
- containers
- corporate_job
- cotton
- data_structures
- design
- dogs
- driving
- fast_food
- filmmaking
- fish
- food
- fortifications
- fruit
- furniture
- gaming
- geography
- ghosts
- history
- houses
- infrastructure
- insurance
- linear_algebra
- machine_learning
- meat
- metals
- military_airforce
- military_army
- military_navy
- minerals
- music_instruments
- music_production
- phones
- physics_optics
- physics_units
- physics_waves
- plants
- radio
- real_estate
- screenwriting
- seasonings
- set_theory
- shopping
- spirits
- sports
- startups
- storage
- travel
- typography
- vcs
- water
- web_development
- wine
- wood
- writing
- art
- collection
- communication
- cooking
- creation
- destruction
- fire
- graphics
- look
- manipulation
- movement
- music
- programming
- thought
- web
2020-02-06 10:14:36 +01:00
## 🙏 Credits
- Wordlist https://github.com/imsky/wordlists
- Icons made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>