保誠-保戶業務員媒合平台
tomasysh
2022-05-25 43d0eed31f4b2a59e23c06ceba3616aac3f549f6
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
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformFromAstSync = exports.transformFromAstAsync = exports.transformFromAst = void 0;
 
function _gensync() {
  const data = require("gensync");
 
  _gensync = function () {
    return data;
  };
 
  return data;
}
 
var _config = require("./config");
 
var _transformation = require("./transformation");
 
const transformFromAstRunner = _gensync()(function* (ast, code, opts) {
  const config = yield* (0, _config.default)(opts);
  if (config === null) return null;
  if (!ast) throw new Error("No AST given");
  return yield* (0, _transformation.run)(config, code, ast);
});
 
const transformFromAst = function transformFromAst(ast, code, opts, callback) {
  if (typeof opts === "function") {
    callback = opts;
    opts = undefined;
  }
 
  if (callback === undefined) {
    return transformFromAstRunner.sync(ast, code, opts);
  }
 
  transformFromAstRunner.errback(ast, code, opts, callback);
};
 
exports.transformFromAst = transformFromAst;
const transformFromAstSync = transformFromAstRunner.sync;
exports.transformFromAstSync = transformFromAstSync;
const transformFromAstAsync = transformFromAstRunner.async;
exports.transformFromAstAsync = transformFromAstAsync;