index.js 724 B

123456789101112131415161718192021222324
  1. "use strict";
  2. module.exports = (args) => {
  3. const options = {};
  4. const params = args.filter(arg => {
  5. const doubleDashMatch = arg.match(/^--(\w[\w-.]*)(=(\S+))?$/);
  6. if (doubleDashMatch) {
  7. options[doubleDashMatch[1]] =
  8. Number(doubleDashMatch[3]) || doubleDashMatch[3] || true;
  9. return false;
  10. }
  11. const singleDashMatch = arg.match(/^-(\w)(=(\S+))?$/);
  12. if (singleDashMatch) {
  13. options[singleDashMatch[1]] =
  14. Number(singleDashMatch[3]) || singleDashMatch[3] || true;
  15. return false;
  16. }
  17. return true;
  18. });
  19. return {
  20. options,
  21. params
  22. };
  23. };
  24. //# sourceMappingURL=index.js.map