index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. Object.defineProperty(exports, "default", {
  6. enumerable: true,
  7. get: function () {
  8. return _full.default;
  9. }
  10. });
  11. exports.loadOptionsAsync = exports.loadOptionsSync = exports.loadOptions = exports.loadPartialConfigAsync = exports.loadPartialConfigSync = exports.loadPartialConfig = void 0;
  12. function _gensync() {
  13. const data = _interopRequireDefault(require("gensync"));
  14. _gensync = function () {
  15. return data;
  16. };
  17. return data;
  18. }
  19. var _full = _interopRequireDefault(require("./full"));
  20. var _partial = require("./partial");
  21. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  22. const loadOptionsRunner = (0, _gensync().default)(function* (opts) {
  23. var _config$options;
  24. const config = yield* (0, _full.default)(opts);
  25. return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null;
  26. });
  27. const maybeErrback = runner => (opts, callback) => {
  28. if (callback === undefined && typeof opts === "function") {
  29. callback = opts;
  30. opts = undefined;
  31. }
  32. return callback ? runner.errback(opts, callback) : runner.sync(opts);
  33. };
  34. const loadPartialConfig = maybeErrback(_partial.loadPartialConfig);
  35. exports.loadPartialConfig = loadPartialConfig;
  36. const loadPartialConfigSync = _partial.loadPartialConfig.sync;
  37. exports.loadPartialConfigSync = loadPartialConfigSync;
  38. const loadPartialConfigAsync = _partial.loadPartialConfig.async;
  39. exports.loadPartialConfigAsync = loadPartialConfigAsync;
  40. const loadOptions = maybeErrback(loadOptionsRunner);
  41. exports.loadOptions = loadOptions;
  42. const loadOptionsSync = loadOptionsRunner.sync;
  43. exports.loadOptionsSync = loadOptionsSync;
  44. const loadOptionsAsync = loadOptionsRunner.async;
  45. exports.loadOptionsAsync = loadOptionsAsync;