summaryrefslogtreecommitdiffstats
path: root/dgbuilder/dgeflows/node_modules/express/node_modules/path-to-regexp/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'dgbuilder/dgeflows/node_modules/express/node_modules/path-to-regexp/index.js')
-rw-r--r--dgbuilder/dgeflows/node_modules/express/node_modules/path-to-regexp/index.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/dgbuilder/dgeflows/node_modules/express/node_modules/path-to-regexp/index.js b/dgbuilder/dgeflows/node_modules/express/node_modules/path-to-regexp/index.js
new file mode 100644
index 00000000..2801f914
--- /dev/null
+++ b/dgbuilder/dgeflows/node_modules/express/node_modules/path-to-regexp/index.js
@@ -0,0 +1,70 @@
+/**
+ * Expose `pathtoRegexp`.
+ */
+
+module.exports = pathtoRegexp;
+
+/**
+ * Normalize the given path string,
+ * returning a regular expression.
+ *
+ * An empty array should be passed,
+ * which will contain the placeholder
+ * key names. For example "/user/:id" will
+ * then contain ["id"].
+ *
+ * @param {String|RegExp|Array} path
+ * @param {Array} keys
+ * @param {Object} options
+ * @return {RegExp}
+ * @api private
+ */
+
+function pathtoRegexp(path, keys, options) {
+ options = options || {};
+ var strict = options.strict;
+ var end = options.end !== false;
+ var flags = options.sensitive ? '' : 'i';
+ keys = keys || [];
+
+ if (path instanceof RegExp) {
+ return path;
+ }
+
+ if (Array.isArray(path)) {
+ // Map array parts into regexps and return their source. We also pass
+ // the same keys and options instance into every generation to get
+ // consistent matching groups before we join the sources together.
+ path = path.map(function (value) {
+ return pathtoRegexp(value, keys, options).source;
+ });
+
+ return new RegExp('(?:' + path.join('|') + ')', flags);
+ }
+
+ path = ('^' + path + (strict ? '' : path[path.length - 1] === '/' ? '?' : '/?'))
+ .replace(/\/\(/g, '/(?:')
+ .replace(/([\/\.])/g, '\\$1')
+ .replace(/(\\\/)?(\\\.)?:(\w+)(\(.*?\))?(\*)?(\?)?/g, function (match, slash, format, key, capture, star, optional) {
+ slash = slash || '';
+ format = format || '';
+ capture = capture || '([^\\/' + format + ']+?)';
+ optional = optional || '';
+
+ keys.push({ name: key, optional: !!optional });
+
+ return ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + format + (optional ? slash : '') + capture
+ + (star ? '((?:[\\/' + format + '].+?)?)' : '')
+ + ')'
+ + optional;
+ })
+ .replace(/\*/g, '(.*)');
+
+ // If the path is non-ending, match until the end or a slash.
+ path += (end ? '$' : (path[path.length - 1] === '/' ? '' : '(?=\\/|$)'));
+
+ return new RegExp(path, flags);
+};