summaryrefslogtreecommitdiff
path: root/includes/external/addressbook/node_modules/validator/lib/isUUID.js
diff options
context:
space:
mode:
Diffstat (limited to 'includes/external/addressbook/node_modules/validator/lib/isUUID.js')
-rw-r--r--includes/external/addressbook/node_modules/validator/lib/isUUID.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/validator/lib/isUUID.js b/includes/external/addressbook/node_modules/validator/lib/isUUID.js
new file mode 100644
index 0000000..f2fdc79
--- /dev/null
+++ b/includes/external/addressbook/node_modules/validator/lib/isUUID.js
@@ -0,0 +1,28 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = isUUID;
+
+var _assertString = _interopRequireDefault(require("./util/assertString"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var uuid = {
+ 1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
+ 2: /^[0-9A-F]{8}-[0-9A-F]{4}-2[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
+ 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
+ 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
+ 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
+ all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
+};
+
+function isUUID(str, version) {
+ (0, _assertString.default)(str);
+ var pattern = uuid[![undefined, null].includes(version) ? version : 'all'];
+ return !!pattern && pattern.test(str);
+}
+
+module.exports = exports.default;
+module.exports.default = exports.default; \ No newline at end of file