Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-username

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-username - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

41

index.js

@@ -0,28 +1,29 @@

#!/usr/bin/env node
var request = require('request');
if(process.argv[2]) {
checkCredentials(process.argv[2]);
if (process.argv[2]) {
checkCredentials(process.argv[2]);
} else {
console.log('Please enter a name.');
process.exit(0);
}
else {
console.log('Please enter a name.');
process.exit(0);
}
function checkCredentials(username) {
var req = {
url : 'https://www.npmjs.com/~'+username
}
request(req, function(err, resp, body) {
if(err)
console.log('Some error occured in searching your username.');
else {
if(resp.statusCode === 200)
console.log('The username already exists :(');
else if(resp.statusCode === 404 || resp.statusCode === 500)
console.log('The username is available :)');
else
console.log('Existence of the username could not be determined by this module. Sorry :(')
var req = {
url: 'https://www.npmjs.com/~' + username
}
});
request(req, function(err, resp, body) {
if (err)
console.log('Some error occured in searching your username.');
else {
if (resp.statusCode === 200)
console.log('The username already exists :(');
else if (resp.statusCode === 404 || resp.statusCode === 500)
console.log('The username is available :)');
else
console.log('Existence of the username could not be determined by this module. Sorry :(')
}
});
}
{
"name": "npm-username",
"version": "0.0.1",
"version": "0.0.2",
"description": "Check availability of username in npm",

@@ -5,0 +5,0 @@ "main": "index.js",

# npm-username
Check the availability of npm username
Check the availability of npm username. Comes in handy when doing ```npm adduser```
## Install
```
$ npm install npm-username -g
```
## Usage
```
$ npm-username '<username>'
```
## Example
```
$ npm-username 'jsmith'
$ The username already exists :(
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc