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

safe-url-input-checker

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

safe-url-input-checker

Safe Url Input Checker is a node.js library to check url safety.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

#Safe Url Input Checker

Safe Url Input Checker is a node.js library to check url safety.

#Dependencies

ip

Q

#API

for some methods you can use callback or not. Just few methods require a callback especially.

var urlChecker = require('safe-url-input-checker')

checkUrlSafety

var options = {};
options.blacklist = [
	'joker.com',
	'slade.io',
	'twoface.net',
	'...',
	'magneto.vilain'
];
options.protocolScheme = [
	'http',
	'https',
	'ftp'
];
urlChecker.checkUrlSafety('localhost', function(err, res) {
	console.log(res); // false
});
urlChecker.checkUrlSafety('http://batman.com', function(err, res) {
	console.log(res); // true
});
urlChecker.checkUrlSafety('http://joker.com', function(err, res) {
	console.log(res); // false
}, options);
urlChecker.checkUrlSafety('w3.com', function(err, res) {
	console.log(res); // true
}, options);

getIPAddresses (optional callback)

urlChecker.getIPAddresses('localhost', function(err, res) {
	if(err) throw err;
	console.log(res); // ['127.0.0.1']
});

isAddressLocal (optional callback)

urlChecker.isAddressLocal('127.0.0.1', function(err, res) {
	if(err) throw err;
	console.log(res) // true
});

isHostLocal (requested callback)

urlChecker.isHostLocal('google.com', function(err, res) {
	if(err) throw err;
	console.log(res) // false
});

isHostBlacklisted (optional callback)

var blacklist = [
	'joker.com',
	'slade.io',
	'twoface.net',
	'...',
	'magneto.vilain'
];
urlChecker.isHostBlacklisted('joker.com', blacklist, function(err, res) {
	console.log(res); // true
});

isProtocolAcceptable (optional callback)

var protocolScheme = [
	'http',
	'https',
	'ftp'
];
urlChecker.isProtocolAcceptable('http', protocolScheme, function(err, res) {
	console.log(res); // true
});

resolveAndParseUrl (optional callback)

urlChecker.resolveAndParseUrl('google.com', function(err, res) {
	console.log(res) // url object
});

#Licence

Copyright (c) 2014 Guillaume Baudusseau

MIT

FAQs

Package last updated on 18 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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