Skip to content

Commit 0de3bd4

Browse files
authored
Merge pull request #89 from mondeja/optimize-import
Defer protocol imports
2 parents 8040938 + 4656bdf commit 0de3bd4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
const { URL } = require('url');
44

55
const protocols = {
6-
hash: require('./lib/proto/hash'),
7-
file: require('./lib/proto/file'),
8-
http: require('./lib/proto/http'),
9-
https: require('./lib/proto/https'),
10-
mailto: require('./lib/proto/mailto'),
6+
hash: function () { return require('./lib/proto/hash'); },
7+
file: function () { return require('./lib/proto/file'); },
8+
http: function () { return require('./lib/proto/http'); },
9+
https: function () { return require('./lib/proto/https'); },
10+
mailto: function () { return require('./lib/proto/mailto'); },
1111
};
1212

1313
module.exports = function linkCheck(link, opts, callback) {
@@ -26,7 +26,7 @@ module.exports = function linkCheck(link, opts, callback) {
2626
return;
2727
}
2828

29-
protocols[protocol].check(link, opts, callback);
29+
protocols[protocol]().check(link, opts, callback);
3030
};
3131

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

0 commit comments

Comments
 (0)