source: imaps-frontend/node_modules/uuid/dist/esm-browser/uuid-bin.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[79a0317]1import * as assert from 'assert';
2import v1 from './v1.js';
3import v3 from './v3.js';
4import v4 from './v4.js';
5import v5 from './v5.js';
6import v6 from './v6.js';
7import v7 from './v7.js';
8function 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 v6');
16 console.log(' uuid v7');
17 console.log(' uuid --help');
18 console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC9562');
19}
20const args = process.argv.slice(2);
21if (args.indexOf('--help') >= 0) {
22 usage();
23 process.exit(0);
24}
25const version = args.shift() || 'v4';
26switch (version) {
27 case 'v1':
28 console.log(v1());
29 break;
30 case 'v3': {
31 const name = args.shift();
32 let namespace = args.shift();
33 assert.ok(name != null, 'v3 name not specified');
34 assert.ok(namespace != null, 'v3 namespace not specified');
35 if (namespace === 'URL') {
36 namespace = v3.URL;
37 }
38 if (namespace === 'DNS') {
39 namespace = v3.DNS;
40 }
41 console.log(v3(name, namespace));
42 break;
43 }
44 case 'v4':
45 console.log(v4());
46 break;
47 case 'v5': {
48 const name = args.shift();
49 let namespace = args.shift();
50 assert.ok(name != null, 'v5 name not specified');
51 assert.ok(namespace != null, 'v5 namespace not specified');
52 if (namespace === 'URL') {
53 namespace = v5.URL;
54 }
55 if (namespace === 'DNS') {
56 namespace = v5.DNS;
57 }
58 console.log(v5(name, namespace));
59 break;
60 }
61 case 'v6':
62 console.log(v6());
63 break;
64 case 'v7':
65 console.log(v7());
66 break;
67 default:
68 usage();
69 process.exit(1);
70}
Note: See TracBrowser for help on using the repository browser.