diff options
| author | Adam Soltys <[email protected]> | 2023-01-08 21:05:34 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-08 21:05:34 -0800 |
| commit | dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7 (patch) | |
| tree | 6c6b8930ebe9c2cc5b8d1f759e61260f509fdd7a /apidoc/vendor/path-to-regexp | |
| parent | f7b844883506a8072213245b9b8a2b988694e4f5 (diff) | |
| download | coinos-server-dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7.tar.gz coinos-server-dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7.zip | |
tech debt jubilee
Diffstat (limited to 'apidoc/vendor/path-to-regexp')
| -rw-r--r-- | apidoc/vendor/path-to-regexp/LICENSE | 21 | ||||
| -rw-r--r-- | apidoc/vendor/path-to-regexp/index.js | 204 |
2 files changed, 0 insertions, 225 deletions
diff --git a/apidoc/vendor/path-to-regexp/LICENSE b/apidoc/vendor/path-to-regexp/LICENSE deleted file mode 100644 index 983fbe8a..00000000 --- a/apidoc/vendor/path-to-regexp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Blake Embrey ([email protected]) - -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/apidoc/vendor/path-to-regexp/index.js b/apidoc/vendor/path-to-regexp/index.js deleted file mode 100644 index 5cb8ed8b..00000000 --- a/apidoc/vendor/path-to-regexp/index.js +++ /dev/null @@ -1,204 +0,0 @@ -var isArray = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -/** - * Expose `pathToRegexp`. - */ -// module.exports = pathToRegexp - -/** - * The main path matching regexp utility. - * - * @type {RegExp} - */ -var PATH_REGEXP = new RegExp([ - // Match escaped characters that would otherwise appear in future matches. - // This allows the user to escape special characters that won't transform. - '(\\\\.)', - // Match Express-style parameters and un-named parameters with a prefix - // and optional suffixes. Matches appear as: - // - // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"] - // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined] - '([\\/.])?(?:\\:(\\w+)(?:\\(((?:\\\\.|[^)])*)\\))?|\\(((?:\\\\.|[^)])*)\\))([+*?])?', - // Match regexp special characters that are always escaped. - '([.+*?=^!:${}()[\\]|\\/])' -].join('|'), 'g'); - -/** - * Escape the capturing group by escaping special characters and meaning. - * - * @param {String} group - * @return {String} - */ -function escapeGroup (group) { - return group.replace(/([=!:$\/()])/g, '\\$1'); -} - -/** - * Attach the keys as a property of the regexp. - * - * @param {RegExp} re - * @param {Array} keys - * @return {RegExp} - */ -function attachKeys (re, keys) { - re.keys = keys; - return re; -} - -/** - * Get the flags for a regexp from the options. - * - * @param {Object} options - * @return {String} - */ -function flags (options) { - return options.sensitive ? '' : 'i'; -} - -/** - * Pull out keys from a regexp. - * - * @param {RegExp} path - * @param {Array} keys - * @return {RegExp} - */ -function regexpToRegexp (path, keys) { - // Use a negative lookahead to match only capturing groups. - var groups = path.source.match(/\((?!\?)/g); - - if (groups) { - for (var i = 0; i < groups.length; i++) { - keys.push({ - name: i, - delimiter: null, - optional: false, - repeat: false - }); - } - } - - return attachKeys(path, keys); -} - -/** - * Transform an array into a regexp. - * - * @param {Array} path - * @param {Array} keys - * @param {Object} options - * @return {RegExp} - */ -function arrayToRegexp (path, keys, options) { - var parts = []; - - for (var i = 0; i < path.length; i++) { - parts.push(pathToRegexp(path[i], keys, options).source); - } - - var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); - return attachKeys(regexp, keys); -} - -/** - * Replace the specific tags with regexp strings. - * - * @param {String} path - * @param {Array} keys - * @return {String} - */ -function replacePath (path, keys) { - var index = 0; - - function replace (_, escaped, prefix, key, capture, group, suffix, escape) { - if (escaped) { - return escaped; - } - - if (escape) { - return '\\' + escape; - } - - var repeat = suffix === '+' || suffix === '*'; - var optional = suffix === '?' || suffix === '*'; - - keys.push({ - name: key || index++, - delimiter: prefix || '/', - optional: optional, - repeat: repeat - }); - - prefix = prefix ? ('\\' + prefix) : ''; - capture = escapeGroup(capture || group || '[^' + (prefix || '\\/') + ']+?'); - - if (repeat) { - capture = capture + '(?:' + prefix + capture + ')*'; - } - - if (optional) { - return '(?:' + prefix + '(' + capture + '))?'; - } - - // Basic parameter support. - return prefix + '(' + capture + ')'; - } - - return path.replace(PATH_REGEXP, replace); -} - -/** - * Normalize the given path string, returning a regular expression. - * - * An empty array can be passed in for the keys, which will hold the - * placeholder key descriptions. For example, using `/user/:id`, `keys` will - * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. - * - * @param {(String|RegExp|Array)} path - * @param {Array} [keys] - * @param {Object} [options] - * @return {RegExp} - */ -function pathToRegexp (path, keys, options) { - keys = keys || []; - - if (!isArray(keys)) { - options = keys; - keys = []; - } else if (!options) { - options = {}; - } - - if (path instanceof RegExp) { - return regexpToRegexp(path, keys, options); - } - - if (isArray(path)) { - return arrayToRegexp(path, keys, options); - } - - var strict = options.strict; - var end = options.end !== false; - var route = replacePath(path, keys); - var endsWithSlash = path.charAt(path.length - 1) === '/'; - - // In non-strict mode we allow a slash at the end of match. If the path to - // match already ends with a slash, we remove it for consistency. The slash - // is valid at the end of a path match, not in the middle. This is important - // in non-ending mode, where "/test/" shouldn't match "/test//route". - if (!strict) { - route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?'; - } - - if (end) { - route += '$'; - } else { - // In non-ending mode, we need the capturing groups to match as much as - // possible by using a positive lookahead to the end or next path segment. - route += strict && endsWithSlash ? '' : '(?=\\/|$)'; - } - - return attachKeys(new RegExp('^' + route, flags(options)), keys); -} |
