main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100755
|
File size:
868 bytes
|
Rev | Line | |
---|
[d565449] | 1 | const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
---|
| 2 | const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
|
---|
| 3 | //RFC 4122
|
---|
| 4 | const 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 | };
|
---|
| 22 | export default handler;
|
---|
| 23 | //# sourceMappingURL=urn-uuid.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.