Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

Commit 3bd520c

Browse files
committed
#19 pass context as constructor param to simplify code
1 parent ed75633 commit 3bd520c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/LoadersList.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
function LoadersList(list) {
5+
function LoadersList(list, context) {
66
this.list = list || [];
7+
this.context = context;
78
this.list.forEach(function(element) {
89
if(element === null || typeof element !== "object")
910
throw new Error("Each element of the loaders list must be an object or array");
@@ -63,7 +64,7 @@ function getLoadersFromObject(element) {
6364
LoadersList.prototype.matchPart = function matchPart(str, test) {
6465
if(!test) return true;
6566
var matcher = asMatcher(test);
66-
return matcher(str);
67+
return matcher(str, this.context);
6768
};
6869

6970
LoadersList.prototype.match = function match(str) {

0 commit comments

Comments
 (0)