(factory)
| 8 | flow = require('js-flow'); |
| 9 | |
| 10 | function wrapFactory(factory) { |
| 11 | if (typeof(factory) == 'function') { |
| 12 | if (factory.length < 4) { |
| 13 | return function (data, host, info, callback) { |
| 14 | var instance = factory(data, host, info); |
| 15 | callback(null, instance); |
| 16 | }; |
| 17 | } else { |
| 18 | return factory; |
| 19 | } |
| 20 | } else { |
| 21 | return function (data, host, info, callback) { callback(); return null; } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | /** @class ModulePlugin |
| 26 | * Plugin loaded from a Node.js module |