options.js 275 B

123456789101112131415
  1. 'use strict';
  2. let options = null;
  3. exports.get = () => {
  4. if (!options) {
  5. throw new Error('Options have not yet been set');
  6. }
  7. return options;
  8. };
  9. exports.set = newOptions => {
  10. if (options) {
  11. throw new Error('Options have already been set');
  12. }
  13. options = newOptions;
  14. };