a zip code crypto-currency system good for red ONLY

prepareOptions.js 684B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. module.exports = function prepareOptions(options, argv) {
  3. argv = argv || {};
  4. options = handleExport(options);
  5. if(Array.isArray(options)) {
  6. options = options.map(_options => handleFunction(_options, argv));
  7. } else {
  8. options = handleFunction(options, argv);
  9. }
  10. return options;
  11. };
  12. function handleExport(options) {
  13. const isES6DefaultExported = (
  14. typeof options === "object" && options !== null && typeof options.default !== "undefined"
  15. );
  16. options = isES6DefaultExported ? options.default : options;
  17. return options;
  18. }
  19. function handleFunction(options, argv) {
  20. if(typeof options === "function") {
  21. options = options(argv.env, argv);
  22. }
  23. return options;
  24. }