https://github.com/andrewda/valid-github-username
https://github.com/andrewda/valid-github-username
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/andrewda/valid-github-username
- Owner: andrewda
- Created: 2017-12-12T05:56:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-27T20:37:07.000Z (over 7 years ago)
- Last Synced: 2025-04-22T04:08:39.201Z (about 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# valid-github-username
## Installation
Make sure you have node installed. Then clone the repo.
git clone https://github.com/andrewda/valid-github-username.git
## Usage
Use this code to import the code:
const validGitHubUsername = require('./index');
then use the function by passing in a username:
let username = validGitHubUsername('kx chen');
It will then return a new username that is valid (in this example without spaces).
## Checks it performs:
> valid-github-username@0.0.1 test /home/sheshank/valid-github-username
> mocha test.js
removes illegal characters
✓ removes spaces
✓ removes special characters
removes illegal hyphen placement
✓ removes consecutive dashes
✓ removes trailing dashes
✓ removes leading dashes
length should not exceed 39
✓ does not accept length > 39
## Final output:
If it passes it should output `passing`. For ex:
6 passing (7ms)