summaryrefslogtreecommitdiff
path: root/includes/external/addressbook/node_modules/validator/lib/isSemVer.js
diff options
context:
space:
mode:
Diffstat (limited to 'includes/external/addressbook/node_modules/validator/lib/isSemVer.js')
-rw-r--r--includes/external/addressbook/node_modules/validator/lib/isSemVer.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/validator/lib/isSemVer.js b/includes/external/addressbook/node_modules/validator/lib/isSemVer.js
new file mode 100644
index 0000000..27355cd
--- /dev/null
+++ b/includes/external/addressbook/node_modules/validator/lib/isSemVer.js
@@ -0,0 +1,28 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = isSemVer;
+
+var _assertString = _interopRequireDefault(require("./util/assertString"));
+
+var _multilineRegex = _interopRequireDefault(require("./util/multilineRegex"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Regular Expression to match
+ * semantic versioning (SemVer)
+ * built from multi-line, multi-parts regexp
+ * Reference: https://semver.org/
+ */
+var semanticVersioningRegex = (0, _multilineRegex.default)(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i');
+
+function isSemVer(str) {
+ (0, _assertString.default)(str);
+ return semanticVersioningRegex.test(str);
+}
+
+module.exports = exports.default;
+module.exports.default = exports.default; \ No newline at end of file