source: trip-planner-front/node_modules/uuid/dist/uuid-bin.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1"use strict";
2
3var _assert = _interopRequireDefault(require("assert"));
4
5var _v = _interopRequireDefault(require("./v1.js"));
6
7var _v2 = _interopRequireDefault(require("./v3.js"));
8
9var _v3 = _interopRequireDefault(require("./v4.js"));
10
11var _v4 = _interopRequireDefault(require("./v5.js"));
12
13function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15function usage() {
16 console.log('Usage:');
17 console.log(' uuid');
18 console.log(' uuid v1');
19 console.log(' uuid v3 <name> <namespace uuid>');
20 console.log(' uuid v4');
21 console.log(' uuid v5 <name> <namespace uuid>');
22 console.log(' uuid --help');
23 console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
24}
25
26const args = process.argv.slice(2);
27
28if (args.indexOf('--help') >= 0) {
29 usage();
30 process.exit(0);
31}
32
33const version = args.shift() || 'v4';
34
35switch (version) {
36 case 'v1':
37 console.log((0, _v.default)());
38 break;
39
40 case 'v3':
41 {
42 const name = args.shift();
43 let namespace = args.shift();
44 (0, _assert.default)(name != null, 'v3 name not specified');
45 (0, _assert.default)(namespace != null, 'v3 namespace not specified');
46
47 if (namespace === 'URL') {
48 namespace = _v2.default.URL;
49 }
50
51 if (namespace === 'DNS') {
52 namespace = _v2.default.DNS;
53 }
54
55 console.log((0, _v2.default)(name, namespace));
56 break;
57 }
58
59 case 'v4':
60 console.log((0, _v3.default)());
61 break;
62
63 case 'v5':
64 {
65 const name = args.shift();
66 let namespace = args.shift();
67 (0, _assert.default)(name != null, 'v5 name not specified');
68 (0, _assert.default)(namespace != null, 'v5 namespace not specified');
69
70 if (namespace === 'URL') {
71 namespace = _v4.default.URL;
72 }
73
74 if (namespace === 'DNS') {
75 namespace = _v4.default.DNS;
76 }
77
78 console.log((0, _v4.default)(name, namespace));
79 break;
80 }
81
82 default:
83 usage();
84 process.exit(1);
85}
Note: See TracBrowser for help on using the repository browser.