options.js 978 B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getOptions = getOptions;
  6. // A second optional argument can be given to further configure
  7. var defaultOptions = exports.defaultOptions = {
  8. // Source type ("script" or "module") for different semantics
  9. sourceType: "script",
  10. // Source filename.
  11. sourceFilename: undefined,
  12. // When enabled, a return at the top level is not considered an
  13. // error.
  14. allowReturnOutsideFunction: false,
  15. // When enabled, import/export statements are not constrained to
  16. // appearing at the top of the program.
  17. allowImportExportEverywhere: false,
  18. // TODO
  19. allowSuperOutsideMethod: false,
  20. // An array of plugins to enable
  21. plugins: [],
  22. // TODO
  23. strictMode: null
  24. };
  25. // Interpret and default an options object
  26. function getOptions(opts) {
  27. var options = {};
  28. for (var key in defaultOptions) {
  29. options[key] = opts && key in opts ? opts[key] : defaultOptions[key];
  30. }
  31. return options;
  32. }