UNPKG

514 BJavaScriptView Raw
1// Used by the resolve method to execute the plugin constructor with the parameters provided.
2module.exports = function(name, plugin) {
3 if (!plugin.klass)
4 throw new Error("Failed to resolve '" + name + "'. Expected constructor not to be null.");
5
6 return (function() {
7 function F(args) {
8 return plugin.klass.apply(this, args);
9 }
10
11 F.prototype = plugin.klass.prototype;
12
13 return new F(arguments);
14 }).apply(this, plugin.parameters);
15};