normalize-ast.js 706 B

1234567891011121314151617181920212223
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = function (ast, comments, tokens) {
  4. if (ast) {
  5. if (ast.type === "Program") {
  6. return t.file(ast, comments || [], tokens || []);
  7. } else if (ast.type === "File") {
  8. return ast;
  9. }
  10. }
  11. throw new Error("Not a valid ast?");
  12. };
  13. var _babelTypes = require("babel-types");
  14. var t = _interopRequireWildcard(_babelTypes);
  15. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16. module.exports = exports["default"];