summaryrefslogtreecommitdiffstats
path: root/middleware/node_modules/path-to-regexp
diff options
context:
space:
mode:
authorkrakenrf <>2022-10-27 13:26:32 +0200
committerkrakenrf <>2022-10-27 13:26:32 +0200
commit2127e196322d8c21124dcd15d28fe43b9f8b8ddb (patch)
tree258204ef95239e3923df769e4797c77048da2bfd /middleware/node_modules/path-to-regexp
parentadd middleware folder (diff)
downloadkrakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.tar
krakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.tar.gz
krakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.tar.bz2
krakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.tar.lz
krakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.tar.xz
krakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.tar.zst
krakensdr_pr-2127e196322d8c21124dcd15d28fe43b9f8b8ddb.zip
Diffstat (limited to 'middleware/node_modules/path-to-regexp')
-rw-r--r--middleware/node_modules/path-to-regexp/History.md36
-rw-r--r--middleware/node_modules/path-to-regexp/LICENSE21
-rw-r--r--middleware/node_modules/path-to-regexp/Readme.md35
-rw-r--r--middleware/node_modules/path-to-regexp/index.js129
-rw-r--r--middleware/node_modules/path-to-regexp/package.json30
5 files changed, 251 insertions, 0 deletions
diff --git a/middleware/node_modules/path-to-regexp/History.md b/middleware/node_modules/path-to-regexp/History.md
new file mode 100644
index 0000000..7f65878
--- /dev/null
+++ b/middleware/node_modules/path-to-regexp/History.md
@@ -0,0 +1,36 @@
+0.1.7 / 2015-07-28
+==================
+
+ * Fixed regression with escaped round brackets and matching groups.
+
+0.1.6 / 2015-06-19
+==================
+
+ * Replace `index` feature by outputting all parameters, unnamed and named.
+
+0.1.5 / 2015-05-08
+==================
+
+ * Add an index property for position in match result.
+
+0.1.4 / 2015-03-05
+==================
+
+ * Add license information
+
+0.1.3 / 2014-07-06
+==================
+
+ * Better array support
+ * Improved support for trailing slash in non-ending mode
+
+0.1.0 / 2014-03-06
+==================
+
+ * add options.end
+
+0.0.2 / 2013-02-10
+==================
+
+ * Update to match current express
+ * add .license property to component.json
diff --git a/middleware/node_modules/path-to-regexp/LICENSE b/middleware/node_modules/path-to-regexp/LICENSE
new file mode 100644
index 0000000..983fbe8
--- /dev/null
+++ b/middleware/node_modules/path-to-regexp/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/middleware/node_modules/path-to-regexp/Readme.md b/middleware/node_modules/path-to-regexp/Readme.md
new file mode 100644
index 0000000..95452a6
--- /dev/null
+++ b/middleware/node_modules/path-to-regexp/Readme.md
@@ -0,0 +1,35 @@
+# Path-to-RegExp
+
+Turn an Express-style path string such as `/user/:name` into a regular expression.
+
+**Note:** This is a legacy branch. You should upgrade to `1.x`.
+
+## Usage
+
+```javascript
+var pathToRegexp = require('path-to-regexp');
+```
+
+### pathToRegexp(path, keys, options)
+
+ - **path** A string in the express format, an array of such strings, or a regular expression
+ - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings.
+ - **options**
+ - **options.sensitive** Defaults to false, set this to true to make routes case sensitive
+ - **options.strict** Defaults to false, set this to true to make the trailing slash matter.
+ - **options.end** Defaults to true, set this to false to only match the prefix of the URL.
+
+```javascript
+var keys = [];
+var exp = pathToRegexp('/foo/:bar', keys);
+//keys = ['bar']
+//exp = /^\/foo\/(?:([^\/]+?))\/?$/i
+```
+
+## Live Demo
+
+You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/).
+
+## License
+
+ MIT
diff --git a/middleware/node_modules/path-to-regexp/index.js b/middleware/node_modules/path-to-regexp/index.js
new file mode 100644
index 0000000..500d1da
--- /dev/null
+++ b/middleware/node_modules/path-to-regexp/index.js
@@ -0,0 +1,129 @@
+/**
+ * Expose `pathtoRegexp`.
+ */
+
+module.exports = pathtoRegexp;
+
+/**
+ * Match matching groups in a regular expression.
+ */
+var MATCHING_GROUP_REGEXP = /\((?!\?)/g;
+
+/**
+ * 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 || {};
+ keys = keys || [];
+ var strict = options.strict;
+ var end = options.end !== false;
+ var flags = options.sensitive ? '' : 'i';
+ var extraOffset = 0;
+ var keysOffset = keys.length;
+ var i = 0;
+ var name = 0;
+ var m;
+
+ if (path instanceof RegExp) {
+ while (m = MATCHING_GROUP_REGEXP.exec(path.source)) {
+ keys.push({
+ name: name++,
+ optional: false,
+ offset: m.index
+ });
+ }
+
+ 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, offset) {
+ slash = slash || '';
+ format = format || '';
+ capture = capture || '([^\\/' + format + ']+?)';
+ optional = optional || '';
+
+ keys.push({
+ name: key,
+ optional: !!optional,
+ offset: offset + extraOffset
+ });
+
+ var result = ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + format + (optional ? slash : '') + capture
+ + (star ? '((?:[\\/' + format + '].+?)?)' : '')
+ + ')'
+ + optional;
+
+ extraOffset += result.length - match.length;
+
+ return result;
+ })
+ .replace(/\*/g, function (star, index) {
+ var len = keys.length
+
+ while (len-- > keysOffset && keys[len].offset > index) {
+ keys[len].offset += 3; // Replacement length minus asterisk length.
+ }
+
+ return '(.*)';
+ });
+
+ // This is a workaround for handling unnamed matching groups.
+ while (m = MATCHING_GROUP_REGEXP.exec(path)) {
+ var escapeCount = 0;
+ var index = m.index;
+
+ while (path.charAt(--index) === '\\') {
+ escapeCount++;
+ }
+
+ // It's possible to escape the bracket.
+ if (escapeCount % 2 === 1) {
+ continue;
+ }
+
+ if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
+ keys.splice(keysOffset + i, 0, {
+ name: name++, // Unnamed matching groups must be consistently linear.
+ optional: false,
+ offset: m.index
+ });
+ }
+
+ i++;
+ }
+
+ // If the path is non-ending, match until the end or a slash.
+ path += (end ? '$' : (path[path.length - 1] === '/' ? '' : '(?=\\/|$)'));
+
+ return new RegExp(path, flags);
+};
diff --git a/middleware/node_modules/path-to-regexp/package.json b/middleware/node_modules/path-to-regexp/package.json
new file mode 100644
index 0000000..d4e51b5
--- /dev/null
+++ b/middleware/node_modules/path-to-regexp/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "path-to-regexp",
+ "description": "Express style path to RegExp utility",
+ "version": "0.1.7",
+ "files": [
+ "index.js",
+ "LICENSE"
+ ],
+ "scripts": {
+ "test": "istanbul cover _mocha -- -R spec"
+ },
+ "keywords": [
+ "express",
+ "regexp"
+ ],
+ "component": {
+ "scripts": {
+ "path-to-regexp": "index.js"
+ }
+ },
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/component/path-to-regexp.git"
+ },
+ "devDependencies": {
+ "mocha": "^1.17.1",
+ "istanbul": "^0.2.6"
+ }
+}