Skip to content

Commit 8ba55e1

Browse files
timseTheLarkInn
authored andcommitted
refactor of ContextDependency to es6 (webpack#3818)
1 parent d458fcb commit 8ba55e1

1 file changed

Lines changed: 22 additions & 19 deletions

File tree

lib/dependencies/ContextDependency.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var Dependency = require("../Dependency");
5+
"use strict";
6+
const Dependency = require("../Dependency");
67

7-
function ContextDependency(request, recursive, regExp) {
8-
Dependency.call(this);
9-
this.request = request;
10-
this.userRequest = request;
11-
this.recursive = recursive;
12-
this.regExp = regExp;
13-
this.async = false;
8+
class ContextDependency extends Dependency {
9+
constructor(request, recursive, regExp) {
10+
super();
11+
this.request = request;
12+
this.userRequest = request;
13+
this.recursive = recursive;
14+
this.regExp = regExp;
15+
this.async = false;
16+
}
17+
18+
isEqualResource(other) {
19+
if(!(other instanceof ContextDependency))
20+
return false;
21+
22+
return this.request === other.request &&
23+
this.recursive === other.recursive &&
24+
this.regExp === other.regExp &&
25+
this.async === other.async;
26+
}
1427
}
15-
module.exports = ContextDependency;
1628

17-
ContextDependency.prototype = Object.create(Dependency.prototype);
18-
ContextDependency.prototype.constructor = ContextDependency;
19-
ContextDependency.prototype.isEqualResource = function(other) {
20-
if(!(other instanceof ContextDependency))
21-
return false;
22-
return this.request === other.request &&
23-
this.recursive === other.recursive &&
24-
this.regExp === other.regExp &&
25-
this.async === other.async;
26-
};
29+
module.exports = ContextDependency;

0 commit comments

Comments
 (0)