版博士V2.0程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

28 řádky
916 B

  1. 'use strict';
  2. var createPlugin = function (plugin, config) {
  3. return {
  4. handler: plugin,
  5. config: config,
  6. };
  7. };
  8. createPlugin.withOptions = function (pluginFunction, configFunction) {
  9. if (configFunction === void 0) { configFunction = function () { return ({}); }; }
  10. var optionsFunction = function (options) {
  11. if (options === void 0) { options = {}; }
  12. return {
  13. __options: options,
  14. handler: pluginFunction(options),
  15. config: configFunction(options),
  16. };
  17. };
  18. optionsFunction.__isOptionsFunction = true;
  19. // Expose plugin dependencies so that `object-hash` returns a different
  20. // value if anything here changes, to ensure a rebuild is triggered.
  21. optionsFunction.__pluginFunction = pluginFunction;
  22. optionsFunction.__configFunction = configFunction;
  23. return optionsFunction;
  24. };
  25. module.exports = createPlugin;