swa07016

원격저장소 node_module/path-to-regexp 삭제

1 -0.1.7 / 2015-07-28
2 -==================
3 -
4 - * Fixed regression with escaped round brackets and matching groups.
5 -
6 -0.1.6 / 2015-06-19
7 -==================
8 -
9 - * Replace `index` feature by outputting all parameters, unnamed and named.
10 -
11 -0.1.5 / 2015-05-08
12 -==================
13 -
14 - * Add an index property for position in match result.
15 -
16 -0.1.4 / 2015-03-05
17 -==================
18 -
19 - * Add license information
20 -
21 -0.1.3 / 2014-07-06
22 -==================
23 -
24 - * Better array support
25 - * Improved support for trailing slash in non-ending mode
26 -
27 -0.1.0 / 2014-03-06
28 -==================
29 -
30 - * add options.end
31 -
32 -0.0.2 / 2013-02-10
33 -==================
34 -
35 - * Update to match current express
36 - * add .license property to component.json
1 -The MIT License (MIT)
2 -
3 -Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
4 -
5 -Permission is hereby granted, free of charge, to any person obtaining a copy
6 -of this software and associated documentation files (the "Software"), to deal
7 -in the Software without restriction, including without limitation the rights
8 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 -copies of the Software, and to permit persons to whom the Software is
10 -furnished to do so, subject to the following conditions:
11 -
12 -The above copyright notice and this permission notice shall be included in
13 -all copies or substantial portions of the Software.
14 -
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 -THE SOFTWARE.
1 -# Path-to-RegExp
2 -
3 -Turn an Express-style path string such as `/user/:name` into a regular expression.
4 -
5 -**Note:** This is a legacy branch. You should upgrade to `1.x`.
6 -
7 -## Usage
8 -
9 -```javascript
10 -var pathToRegexp = require('path-to-regexp');
11 -```
12 -
13 -### pathToRegexp(path, keys, options)
14 -
15 - - **path** A string in the express format, an array of such strings, or a regular expression
16 - - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings.
17 - - **options**
18 - - **options.sensitive** Defaults to false, set this to true to make routes case sensitive
19 - - **options.strict** Defaults to false, set this to true to make the trailing slash matter.
20 - - **options.end** Defaults to true, set this to false to only match the prefix of the URL.
21 -
22 -```javascript
23 -var keys = [];
24 -var exp = pathToRegexp('/foo/:bar', keys);
25 -//keys = ['bar']
26 -//exp = /^\/foo\/(?:([^\/]+?))\/?$/i
27 -```
28 -
29 -## Live Demo
30 -
31 -You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/).
32 -
33 -## License
34 -
35 - MIT
1 -/**
2 - * Expose `pathtoRegexp`.
3 - */
4 -
5 -module.exports = pathtoRegexp;
6 -
7 -/**
8 - * Match matching groups in a regular expression.
9 - */
10 -var MATCHING_GROUP_REGEXP = /\((?!\?)/g;
11 -
12 -/**
13 - * Normalize the given path string,
14 - * returning a regular expression.
15 - *
16 - * An empty array should be passed,
17 - * which will contain the placeholder
18 - * key names. For example "/user/:id" will
19 - * then contain ["id"].
20 - *
21 - * @param {String|RegExp|Array} path
22 - * @param {Array} keys
23 - * @param {Object} options
24 - * @return {RegExp}
25 - * @api private
26 - */
27 -
28 -function pathtoRegexp(path, keys, options) {
29 - options = options || {};
30 - keys = keys || [];
31 - var strict = options.strict;
32 - var end = options.end !== false;
33 - var flags = options.sensitive ? '' : 'i';
34 - var extraOffset = 0;
35 - var keysOffset = keys.length;
36 - var i = 0;
37 - var name = 0;
38 - var m;
39 -
40 - if (path instanceof RegExp) {
41 - while (m = MATCHING_GROUP_REGEXP.exec(path.source)) {
42 - keys.push({
43 - name: name++,
44 - optional: false,
45 - offset: m.index
46 - });
47 - }
48 -
49 - return path;
50 - }
51 -
52 - if (Array.isArray(path)) {
53 - // Map array parts into regexps and return their source. We also pass
54 - // the same keys and options instance into every generation to get
55 - // consistent matching groups before we join the sources together.
56 - path = path.map(function (value) {
57 - return pathtoRegexp(value, keys, options).source;
58 - });
59 -
60 - return new RegExp('(?:' + path.join('|') + ')', flags);
61 - }
62 -
63 - path = ('^' + path + (strict ? '' : path[path.length - 1] === '/' ? '?' : '/?'))
64 - .replace(/\/\(/g, '/(?:')
65 - .replace(/([\/\.])/g, '\\$1')
66 - .replace(/(\\\/)?(\\\.)?:(\w+)(\(.*?\))?(\*)?(\?)?/g, function (match, slash, format, key, capture, star, optional, offset) {
67 - slash = slash || '';
68 - format = format || '';
69 - capture = capture || '([^\\/' + format + ']+?)';
70 - optional = optional || '';
71 -
72 - keys.push({
73 - name: key,
74 - optional: !!optional,
75 - offset: offset + extraOffset
76 - });
77 -
78 - var result = ''
79 - + (optional ? '' : slash)
80 - + '(?:'
81 - + format + (optional ? slash : '') + capture
82 - + (star ? '((?:[\\/' + format + '].+?)?)' : '')
83 - + ')'
84 - + optional;
85 -
86 - extraOffset += result.length - match.length;
87 -
88 - return result;
89 - })
90 - .replace(/\*/g, function (star, index) {
91 - var len = keys.length
92 -
93 - while (len-- > keysOffset && keys[len].offset > index) {
94 - keys[len].offset += 3; // Replacement length minus asterisk length.
95 - }
96 -
97 - return '(.*)';
98 - });
99 -
100 - // This is a workaround for handling unnamed matching groups.
101 - while (m = MATCHING_GROUP_REGEXP.exec(path)) {
102 - var escapeCount = 0;
103 - var index = m.index;
104 -
105 - while (path.charAt(--index) === '\\') {
106 - escapeCount++;
107 - }
108 -
109 - // It's possible to escape the bracket.
110 - if (escapeCount % 2 === 1) {
111 - continue;
112 - }
113 -
114 - if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
115 - keys.splice(keysOffset + i, 0, {
116 - name: name++, // Unnamed matching groups must be consistently linear.
117 - optional: false,
118 - offset: m.index
119 - });
120 - }
121 -
122 - i++;
123 - }
124 -
125 - // If the path is non-ending, match until the end or a slash.
126 - path += (end ? '$' : (path[path.length - 1] === '/' ? '' : '(?=\\/|$)'));
127 -
128 - return new RegExp(path, flags);
129 -};
1 -{
2 - "_from": "path-to-regexp@0.1.7",
3 - "_id": "path-to-regexp@0.1.7",
4 - "_inBundle": false,
5 - "_integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
6 - "_location": "/path-to-regexp",
7 - "_phantomChildren": {},
8 - "_requested": {
9 - "type": "version",
10 - "registry": true,
11 - "raw": "path-to-regexp@0.1.7",
12 - "name": "path-to-regexp",
13 - "escapedName": "path-to-regexp",
14 - "rawSpec": "0.1.7",
15 - "saveSpec": null,
16 - "fetchSpec": "0.1.7"
17 - },
18 - "_requiredBy": [
19 - "/express"
20 - ],
21 - "_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
22 - "_shasum": "df604178005f522f15eb4490e7247a1bfaa67f8c",
23 - "_spec": "path-to-regexp@0.1.7",
24 - "_where": "C:\\Users\\WP\\Desktop\\오픈소스 SW개발\\프로젝트\\TermProject\\node_modules\\express",
25 - "bugs": {
26 - "url": "https://github.com/component/path-to-regexp/issues"
27 - },
28 - "bundleDependencies": false,
29 - "component": {
30 - "scripts": {
31 - "path-to-regexp": "index.js"
32 - }
33 - },
34 - "deprecated": false,
35 - "description": "Express style path to RegExp utility",
36 - "devDependencies": {
37 - "istanbul": "^0.2.6",
38 - "mocha": "^1.17.1"
39 - },
40 - "files": [
41 - "index.js",
42 - "LICENSE"
43 - ],
44 - "homepage": "https://github.com/component/path-to-regexp#readme",
45 - "keywords": [
46 - "express",
47 - "regexp"
48 - ],
49 - "license": "MIT",
50 - "name": "path-to-regexp",
51 - "repository": {
52 - "type": "git",
53 - "url": "git+https://github.com/component/path-to-regexp.git"
54 - },
55 - "scripts": {
56 - "test": "istanbul cover _mocha -- -R spec"
57 - },
58 - "version": "0.1.7"
59 -}