UNPKG

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