Skip to content

Commit

Permalink
Merge pull request #89 from mondeja/optimize-import
Browse files Browse the repository at this point in the history
Defer protocol imports
  • Loading branch information
tcort authored Nov 5, 2024
2 parents 8040938 + 4656bdf commit 0de3bd4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
const { URL } = require('url');

const protocols = {
hash: require('./lib/proto/hash'),
file: require('./lib/proto/file'),
http: require('./lib/proto/http'),
https: require('./lib/proto/https'),
mailto: require('./lib/proto/mailto'),
hash: function () { return require('./lib/proto/hash'); },
file: function () { return require('./lib/proto/file'); },
http: function () { return require('./lib/proto/http'); },
https: function () { return require('./lib/proto/https'); },
mailto: function () { return require('./lib/proto/mailto'); },
};

module.exports = function linkCheck(link, opts, callback) {
Expand All @@ -26,7 +26,7 @@ module.exports = function linkCheck(link, opts, callback) {
return;
}

protocols[protocol].check(link, opts, callback);
protocols[protocol]().check(link, opts, callback);
};

module.exports.LinkCheckResult = require('./lib/LinkCheckResult');

0 comments on commit 0de3bd4

Please sign in to comment.