Blame view

天文台pc/tianwentai-ui/node_modules/tar/dist/commonjs/make-command.js 1.82 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.makeCommand = void 0;
  const options_js_1 = require("./options.js");
  const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => {
      return Object.assign((opt_ = [], entries, cb) => {
          if (Array.isArray(opt_)) {
              entries = opt_;
              opt_ = {};
          }
          if (typeof entries === 'function') {
              cb = entries;
              entries = undefined;
          }
          entries = !entries ? [] : Array.from(entries);
          const opt = (0, options_js_1.dealias)(opt_);
          validate?.(opt, entries);
          if ((0, options_js_1.isSyncFile)(opt)) {
              if (typeof cb === 'function') {
                  throw new TypeError('callback not supported for sync tar functions');
              }
              return syncFile(opt, entries);
          }
          else if ((0, options_js_1.isAsyncFile)(opt)) {
              const p = asyncFile(opt, entries);
              return cb ? p.then(() => cb(), cb) : p;
          }
          else if ((0, options_js_1.isSyncNoFile)(opt)) {
              if (typeof cb === 'function') {
                  throw new TypeError('callback not supported for sync tar functions');
              }
              return syncNoFile(opt, entries);
          }
          else if ((0, options_js_1.isAsyncNoFile)(opt)) {
              if (typeof cb === 'function') {
                  throw new TypeError('callback only supported with file option');
              }
              return asyncNoFile(opt, entries);
              /* c8 ignore start */
          }
          throw new Error('impossible options??');
          /* c8 ignore stop */
      }, {
          syncFile,
          asyncFile,
          syncNoFile,
          asyncNoFile,
          validate,
      });
  };
  exports.makeCommand = makeCommand;
  //# sourceMappingURL=make-command.js.map