linkfollower
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
if (!link) { | ||
console.log('Usage: linkfollower <URL>'); | ||
console.log('Usage: follow <URL>'); | ||
process.exit(1); | ||
@@ -10,0 +10,0 @@ } |
@@ -9,4 +9,5 @@ const http = require('http'); | ||
return new Promise((resolve, reject) => { | ||
link = prefixWithHttp(link); | ||
let parsedUrl = url.parse(link); | ||
if (parsedUrl.protocol == null || parsedUrl.host == null) { | ||
if (parsedUrl.host == null) { | ||
reject(link + ' is not a valid URL'); | ||
@@ -71,2 +72,11 @@ } | ||
let prefixWithHttp = function(link) { | ||
let pattern = new RegExp('^http'); | ||
if (!pattern.test(link)) { | ||
return 'http://' + link; | ||
} | ||
return link; | ||
} | ||
exports.follow = follow; |
{ | ||
"name": "linkfollower", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Node.js based command line utility that lets you follow redirects to see where http URLs end up. Useful for shortened URLs.", | ||
@@ -5,0 +5,0 @@ "main": "cli.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3647
81