Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. "use strict";
  2. var _assert = _interopRequireDefault(require("assert"));
  3. var _v = _interopRequireDefault(require("./v1.js"));
  4. var _v2 = _interopRequireDefault(require("./v3.js"));
  5. var _v3 = _interopRequireDefault(require("./v4.js"));
  6. var _v4 = _interopRequireDefault(require("./v5.js"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function usage() {
  9. console.log('Usage:');
  10. console.log(' uuid');
  11. console.log(' uuid v1');
  12. console.log(' uuid v3 <name> <namespace uuid>');
  13. console.log(' uuid v4');
  14. console.log(' uuid v5 <name> <namespace uuid>');
  15. console.log(' uuid --help');
  16. console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
  17. }
  18. var args = process.argv.slice(2);
  19. if (args.indexOf('--help') >= 0) {
  20. usage();
  21. process.exit(0);
  22. }
  23. var version = args.shift() || 'v4';
  24. switch (version) {
  25. case 'v1':
  26. console.log((0, _v.default)());
  27. break;
  28. case 'v3':
  29. var name = args.shift();
  30. var namespace = args.shift();
  31. (0, _assert.default)(name != null, 'v3 name not specified');
  32. (0, _assert.default)(namespace != null, 'v3 namespace not specified');
  33. if (namespace === 'URL') namespace = _v2.default.URL;
  34. if (namespace === 'DNS') namespace = _v2.default.DNS;
  35. console.log((0, _v2.default)(name, namespace));
  36. break;
  37. case 'v4':
  38. console.log((0, _v3.default)());
  39. break;
  40. case 'v5':
  41. var name = args.shift();
  42. var namespace = args.shift();
  43. (0, _assert.default)(name != null, 'v5 name not specified');
  44. (0, _assert.default)(namespace != null, 'v5 namespace not specified');
  45. if (namespace === 'URL') namespace = _v4.default.URL;
  46. if (namespace === 'DNS') namespace = _v4.default.DNS;
  47. console.log((0, _v4.default)(name, namespace));
  48. break;
  49. default:
  50. usage();
  51. process.exit(1);
  52. }