Releases: w3c/insafe
Releases · w3c/insafe
Release list
v0.5.1
What's Changed
- Add w3c.json by @vivienlacourba in #15
- remove unneeded deps and update others by @deniak in #16
- Add GH actions and clean up README by @deniak in #17
New Contributors
- @vivienlacourba made their first contribution in #15
- @deniak made their first contribution in #16
Full Changelog: v0.5.0...v0.5.1
v0.5.0
Diff with respect to previous version published on npm: v0.3.0...v0.5.0
v0.4.0
Insafe v0.3.0
not compatible with previous release (v0.2.0)
Features
- URL resolution:
w3.org->http://w3.org - DNS check
- HTTP/HTTPS check (customizable)
- Host blacklist
- Host whitelist
Installation
npm install insafe
Usage
Insafe is a JavaScript Promise-based API.
It exposes a check(options) function that returns a Promise. This Promise will resolve to an object containing:
- resolved url
String - status (true if well formed, else false)
Boolean - error report
Array
or rejects with the unexpected errors the checker encountered when checking the URL
Example:
var insafe = require('insafe');
insafe.check({
url: 'example.com'
}).then(function (res) {
if(res.status == false) {
console.log('not valid url: ' +res.url);
} else {
console.log('The URL is valid.');
}
}).catch(console.log);Several options are available to check the URL:
- url (required): a
String. - statusCodesAccepted: an
Arrayof accepted HTTP(S) status codes. See the default config. - statusCodesRefused: an
Arrayof refused HTTP(S) status codes. See the default config. - blacklist: an
Arrayof blacklisted hosts. - whitelist: an
Arrayof whitelisted hosts.
Example:
var insafe = require('insafe');
insafe.check({
url: 'http://www.w3.org/',
statusCodesAccepted: ["404"],
statusCodesRefused: ["301", "203"],
blacklist: ['h4ck3rz.org'],
whitelist: ['www.w3.org', 'example.com']
}).then(function (res) {
if(res.status == false) {
console.log('not valid url: ' +res.url);
} else {
console.log('The URL is valid.');
}
}).catch(console.log);Insafe v0.2.0
not compatible with previous release (v0.1.0)
Features
- URL resolution:
w3.org->http://w3.org - DNS check
- HTTP/HTTPS check (customizable)
- Host blacklist
- Host whitelist
Installation
npm install insafe
Usage
Insafe is a JavaScript Promise-based API.
It exposes a check(options) function that returns a Promise. This Promise will
- resolves to an empty
Arrayif the URL is valid - resolves to a report
Arrayif the URL is not valid - rejects with the unexpected errors the checker encountered when checking the URL
Example:
var insafe = require('insafe');
insafe.check({
url: 'example.com'
}).then(function (res) {
if(res.length) {
console.log('not valid url: ' +res);
} else {
console.log('The URL is valid.');
}
}).catch(console.log);Several options are available to check the URL:
- url (required): a
String. - statusCodesAccepted: an
Arrayof accepted HTTP(S) status codes. See the default config. - statusCodesRefused: an
Arrayof refused HTTP(S) status codes. See the default config. - blacklist: an
Arrayof blacklisted hosts. - whitelist: an
Arrayof whitelisted hosts.
Example:
var insafe = require('insafe');
insafe.check({
url: 'http://www.w3.org/',
statusCodesAccepted: ["404"],
statusCodesRefused: ["301", "203"],
blacklist: ['h4ck3rz.org'],
whitelist: ['www.w3.org', 'example.com']
}).then(function (res) {
if(res.length) {
console.log('not valid url: ' +res);
} else {
console.log('The URL is valid.');
}
}).catch(console.log);Insafe v0.1.0
Features
- Resolve url:
w3.org->http://w3.org - DNS check
- HTTP/HTTPS check (customizable)
- Host blacklist
- Host whitelist