Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
should only create 1 deprecate function
  • Loading branch information
bmeck committed Sep 12, 2017
commit 54f31125076bdb64853a145836539ac0e2d8341c
8 changes: 4 additions & 4 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ Module._resolveFilename = function(request, parent, isMain) {
return filename;
};


const DEPRECATED_EXTENSION_FILLING = internalUtil.deprecate(() => {
return '.js';
}, 'Loading files without an extension or unknown extension is deprecated', 'DEP0077');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line has more than 80 characters.

// Given a file name, pass it to the proper extension handler.
Module.prototype.load = function(filename) {
debug('load %j for module %j', filename, this.id);
Expand All @@ -519,9 +521,7 @@ Module.prototype.load = function(filename) {

var extension = path.extname(filename);
if (!extension || !Module._extensions[extension]) {
internalUtil.deprecate(() => {
extension = '.js';
}, 'Loading files without an extension or unknown extension is deprecated', 'DEP0077')();
extension = DEPRECATED_EXTENSION_FILLING();
};
Module._extensions[extension](this, filename);
this.loaded = true;
Expand Down