source: trip-planner-front/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js@ 59329aa

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

initial commit

  • Property mode set to 100644
File size: 868 bytes
Line 
1const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
2const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
3//RFC 4122
4const handler = {
5 scheme: "urn:uuid",
6 parse: function (urnComponents, options) {
7 const uuidComponents = urnComponents;
8 uuidComponents.uuid = uuidComponents.nss;
9 uuidComponents.nss = undefined;
10 if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
11 uuidComponents.error = uuidComponents.error || "UUID is not valid.";
12 }
13 return uuidComponents;
14 },
15 serialize: function (uuidComponents, options) {
16 const urnComponents = uuidComponents;
17 //normalize UUID
18 urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
19 return urnComponents;
20 },
21};
22export default handler;
23//# sourceMappingURL=urn-uuid.js.map
Note: See TracBrowser for help on using the repository browser.