swa07016

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

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
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.
# 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
/**
* 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);
};
{
"_from": "path-to-regexp@0.1.7",
"_id": "path-to-regexp@0.1.7",
"_inBundle": false,
"_integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
"_location": "/path-to-regexp",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "path-to-regexp@0.1.7",
"name": "path-to-regexp",
"escapedName": "path-to-regexp",
"rawSpec": "0.1.7",
"saveSpec": null,
"fetchSpec": "0.1.7"
},
"_requiredBy": [
"/express"
],
"_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"_shasum": "df604178005f522f15eb4490e7247a1bfaa67f8c",
"_spec": "path-to-regexp@0.1.7",
"_where": "C:\\Users\\WP\\Desktop\\오픈소스 SW개발\\프로젝트\\TermProject\\node_modules\\express",
"bugs": {
"url": "https://github.com/component/path-to-regexp/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"path-to-regexp": "index.js"
}
},
"deprecated": false,
"description": "Express style path to RegExp utility",
"devDependencies": {
"istanbul": "^0.2.6",
"mocha": "^1.17.1"
},
"files": [
"index.js",
"LICENSE"
],
"homepage": "https://github.com/component/path-to-regexp#readme",
"keywords": [
"express",
"regexp"
],
"license": "MIT",
"name": "path-to-regexp",
"repository": {
"type": "git",
"url": "git+https://github.com/component/path-to-regexp.git"
},
"scripts": {
"test": "istanbul cover _mocha -- -R spec"
},
"version": "0.1.7"
}