Socket
Socket
Sign inDemoInstall

link-check

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

link-check - npm Package Compare versions

Comparing version 5.0.3 to 5.1.0

lib/proto/hash.js

6

CHANGELOG.md
# Changes
## Version 5.1.0
Changes:
* support for hash links
## Version 5.0.3

@@ -4,0 +10,0 @@

5

index.js

@@ -6,2 +6,3 @@ "use strict";

const protocols = {
hash: require('./lib/proto/hash'),
file: require('./lib/proto/file'),

@@ -21,4 +22,4 @@ http: require('./lib/proto/http'),

const url = new URL(link, opts.baseUrl);
const protocol = url.protocol.replace(/:$/, '');
const url = link.startsWith('#') ? link : new URL(link, opts.baseUrl);
const protocol = link.startsWith('#') ? 'hash' : url.protocol.replace(/:$/, '');

@@ -25,0 +26,0 @@ if (!protocols.hasOwnProperty(protocol)) {

2

package.json
{
"name": "link-check",
"version": "5.0.3",
"version": "5.1.0",
"description": "checks whether a hyperlink is alive (200 OK) or dead",

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

@@ -31,2 +31,3 @@ ![Test library workflow status](https://github.com/tcort/link-check/workflows/Test%20library/badge.svg)

* `opts` optional options object containing any of the following optional fields:
* `anchors` array of anchor strings (e.g. `[ "#foo", "#bar" ]`) for checking anchor links (e.g. `<a href="#foo">Foo</a>`).
* `baseUrl` the base URL for relative links.

@@ -33,0 +34,0 @@ * `timeout` timeout in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `"2000ms"`, `20s`, `1m`). Default `10s`.

@@ -491,2 +491,18 @@ 'use strict';

it('should support hash links', function (done) {
linkCheck('#foo', { anchors: ['#foo'] }, function (err, result) {
expect(err).to.be(null);
expect(result.err).to.be(null);
expect(result.status).to.be('alive');
expect(result.statusCode).to.be(200);
linkCheck('#bar', { anchors: ['#foo'] }, function (err, result) {
expect(err).to.be(null);
expect(result.err).to.be(null);
expect(result.status).to.be('dead');
expect(result.statusCode).to.be(404);
done();
});
});
});
});
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