Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 6a6db63

Browse files
committed
make PatternEngines a genuine Object, and set up its method-bearing prototype in the
ES5 Object.create style
1 parent a2f5cf7 commit 6a6db63

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

builder/pattern_engines/pattern_engines.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,15 @@
2121
// My intention here is to make this return an object that can be used to
2222
// obtain any loaded PatternEngine by addressing them like this:
2323
//
24-
// var PatternEngines = require('pattern_engines/pattern_engines');
25-
// var Mustache = PatternEngines('mustache');
24+
// var PatternEngines = require('./pattern_engines/pattern_engines');
25+
// var Mustache = PatternEngines['mustache'];
2626
//
27-
function PatternEngines () {
28-
// do nothing
29-
}
30-
PatternEngines.prototype = {
27+
var PatternEngines = Object.create({
3128
getEngineForPattern: function (pattern) {
3229
console.log('pattern file name: ', pattern.fileName);
3330
return 'mustache';
3431
}
35-
};
32+
});
3633

3734
// try to load all supported engines
3835
supportedPatternEngineNames.forEach(function (engineName) {
@@ -43,5 +40,5 @@
4340
}
4441
});
4542

46-
module.exports = new PatternEngines();
43+
module.exports = PatternEngines;
4744
})();

0 commit comments

Comments
 (0)