aboutsummaryrefslogtreecommitdiffhomepage
path: root/node_modules/parseurl
diff options
context:
space:
mode:
authorYaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx>2017-11-29 11:44:34 +0300
committerYaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx>2017-11-29 11:44:34 +0300
commit67fdec20726e48ba3a934cb25bb30d47ec4a4f29 (patch)
tree37fd9f4f0b0c20103e1646fc83021e4765de3680 /node_modules/parseurl
downloadspanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.tar.gz
spanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.zip
Initial commit, version 0.5.3
Diffstat (limited to 'node_modules/parseurl')
-rw-r--r--node_modules/parseurl/HISTORY.md53
-rw-r--r--node_modules/parseurl/LICENSE24
-rw-r--r--node_modules/parseurl/README.md124
-rw-r--r--node_modules/parseurl/index.js154
-rw-r--r--node_modules/parseurl/package.json117
5 files changed, 472 insertions, 0 deletions
diff --git a/node_modules/parseurl/HISTORY.md b/node_modules/parseurl/HISTORY.md
new file mode 100644
index 0000000..4803393
--- /dev/null
+++ b/node_modules/parseurl/HISTORY.md
@@ -0,0 +1,53 @@
+1.3.2 / 2017-09-09
+==================
+
+ * perf: reduce overhead for full URLs
+ * perf: unroll the "fast-path" `RegExp`
+
+1.3.1 / 2016-01-17
+==================
+
+ * perf: enable strict mode
+
+1.3.0 / 2014-08-09
+==================
+
+ * Add `parseurl.original` for parsing `req.originalUrl` with fallback
+ * Return `undefined` if `req.url` is `undefined`
+
+1.2.0 / 2014-07-21
+==================
+
+ * Cache URLs based on original value
+ * Remove no-longer-needed URL mis-parse work-around
+ * Simplify the "fast-path" `RegExp`
+
+1.1.3 / 2014-07-08
+==================
+
+ * Fix typo
+
+1.1.2 / 2014-07-08
+==================
+
+ * Seriously fix Node.js 0.8 compatibility
+
+1.1.1 / 2014-07-08
+==================
+
+ * Fix Node.js 0.8 compatibility
+
+1.1.0 / 2014-07-08
+==================
+
+ * Incorporate URL href-only parse fast-path
+
+1.0.1 / 2014-03-08
+==================
+
+ * Add missing `require`
+
+1.0.0 / 2014-03-08
+==================
+
+ * Genesis from `connect`
diff --git a/node_modules/parseurl/LICENSE b/node_modules/parseurl/LICENSE
new file mode 100644
index 0000000..27653d3
--- /dev/null
+++ b/node_modules/parseurl/LICENSE
@@ -0,0 +1,24 @@
+
+(The MIT License)
+
+Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
+Copyright (c) 2014-2017 Douglas Christopher Wilson <doug@somethingdoug.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/node_modules/parseurl/README.md b/node_modules/parseurl/README.md
new file mode 100644
index 0000000..a5ccc51
--- /dev/null
+++ b/node_modules/parseurl/README.md
@@ -0,0 +1,124 @@
+# parseurl
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Node.js Version][node-version-image]][node-version-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+
+Parse a URL with memoization.
+
+## Install
+
+This is a [Node.js](https://nodejs.org/en/) module available through the
+[npm registry](https://www.npmjs.com/). Installation is done using the
+[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
+
+```sh
+$ npm install parseurl
+```
+
+## API
+
+```js
+var parseurl = require('parseurl')
+```
+
+### parseurl(req)
+
+Parse the URL of the given request object (looks at the `req.url` property)
+and return the result. The result is the same as `url.parse` in Node.js core.
+Calling this function multiple times on the same `req` where `req.url` does
+not change will return a cached parsed object, rather than parsing again.
+
+### parseurl.original(req)
+
+Parse the original URL of the given request object and return the result.
+This works by trying to parse `req.originalUrl` if it is a string, otherwise
+parses `req.url`. The result is the same as `url.parse` in Node.js core.
+Calling this function multiple times on the same `req` where `req.originalUrl`
+does not change will return a cached parsed object, rather than parsing again.
+
+## Benchmark
+
+```bash
+$ npm run-script bench
+
+> parseurl@1.3.2 bench nodejs-parseurl
+> node benchmark/index.js
+
+ http_parser@2.7.0
+ node@4.8.4
+ v8@4.5.103.47
+ uv@1.9.1
+ zlib@1.2.11
+ ares@1.10.1-DEV
+ icu@56.1
+ modules@46
+ openssl@1.0.2k
+
+> node benchmark/fullurl.js
+
+ Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy"
+
+ 3 tests completed.
+
+ fasturl x 1,246,766 ops/sec ±0.74% (188 runs sampled)
+ nativeurl x 91,536 ops/sec ±0.54% (189 runs sampled)
+ parseurl x 90,645 ops/sec ±0.38% (189 runs sampled)
+
+> node benchmark/pathquery.js
+
+ Parsing URL "/foo/bar?user=tj&pet=fluffy"
+
+ 3 tests completed.
+
+ fasturl x 2,077,650 ops/sec ±0.69% (186 runs sampled)
+ nativeurl x 638,669 ops/sec ±0.67% (189 runs sampled)
+ parseurl x 2,431,842 ops/sec ±0.71% (189 runs sampled)
+
+> node benchmark/samerequest.js
+
+ Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object
+
+ 3 tests completed.
+
+ fasturl x 2,135,391 ops/sec ±0.69% (188 runs sampled)
+ nativeurl x 672,809 ops/sec ±3.83% (186 runs sampled)
+ parseurl x 11,604,947 ops/sec ±0.70% (189 runs sampled)
+
+> node benchmark/simplepath.js
+
+ Parsing URL "/foo/bar"
+
+ 3 tests completed.
+
+ fasturl x 4,961,391 ops/sec ±0.97% (186 runs sampled)
+ nativeurl x 914,931 ops/sec ±0.83% (186 runs sampled)
+ parseurl x 7,559,196 ops/sec ±0.66% (188 runs sampled)
+
+> node benchmark/slash.js
+
+ Parsing URL "/"
+
+ 3 tests completed.
+
+ fasturl x 4,053,379 ops/sec ±0.91% (187 runs sampled)
+ nativeurl x 963,999 ops/sec ±0.58% (189 runs sampled)
+ parseurl x 11,516,143 ops/sec ±0.58% (188 runs sampled)
+```
+
+## License
+
+ [MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/parseurl.svg
+[npm-url]: https://npmjs.org/package/parseurl
+[node-version-image]: https://img.shields.io/node/v/parseurl.svg
+[node-version-url]: https://nodejs.org/en/download/
+[travis-image]: https://img.shields.io/travis/pillarjs/parseurl/master.svg
+[travis-url]: https://travis-ci.org/pillarjs/parseurl
+[coveralls-image]: https://img.shields.io/coveralls/pillarjs/parseurl/master.svg
+[coveralls-url]: https://coveralls.io/r/pillarjs/parseurl?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/parseurl.svg
+[downloads-url]: https://npmjs.org/package/parseurl
diff --git a/node_modules/parseurl/index.js b/node_modules/parseurl/index.js
new file mode 100644
index 0000000..603eabe
--- /dev/null
+++ b/node_modules/parseurl/index.js
@@ -0,0 +1,154 @@
+/*!
+ * parseurl
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var url = require('url')
+var parse = url.parse
+var Url = url.Url
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = parseurl
+module.exports.original = originalurl
+
+/**
+ * Parse the `req` url with memoization.
+ *
+ * @param {ServerRequest} req
+ * @return {Object}
+ * @public
+ */
+
+function parseurl (req) {
+ var url = req.url
+
+ if (url === undefined) {
+ // URL is undefined
+ return undefined
+ }
+
+ var parsed = req._parsedUrl
+
+ if (fresh(url, parsed)) {
+ // Return cached URL parse
+ return parsed
+ }
+
+ // Parse the URL
+ parsed = fastparse(url)
+ parsed._raw = url
+
+ return (req._parsedUrl = parsed)
+};
+
+/**
+ * Parse the `req` original url with fallback and memoization.
+ *
+ * @param {ServerRequest} req
+ * @return {Object}
+ * @public
+ */
+
+function originalurl (req) {
+ var url = req.originalUrl
+
+ if (typeof url !== 'string') {
+ // Fallback
+ return parseurl(req)
+ }
+
+ var parsed = req._parsedOriginalUrl
+
+ if (fresh(url, parsed)) {
+ // Return cached URL parse
+ return parsed
+ }
+
+ // Parse the URL
+ parsed = fastparse(url)
+ parsed._raw = url
+
+ return (req._parsedOriginalUrl = parsed)
+};
+
+/**
+ * Parse the `str` url with fast-path short-cut.
+ *
+ * @param {string} str
+ * @return {Object}
+ * @private
+ */
+
+function fastparse (str) {
+ if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) {
+ return parse(str)
+ }
+
+ var pathname = str
+ var query = null
+ var search = null
+
+ // This takes the regexp from https://github.com/joyent/node/pull/7878
+ // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/
+ // And unrolls it into a for loop
+ for (var i = 1; i < str.length; i++) {
+ switch (str.charCodeAt(i)) {
+ case 0x3f: /* ? */
+ if (search === null) {
+ pathname = str.substring(0, i)
+ query = str.substring(i + 1)
+ search = str.substring(i)
+ }
+ break
+ case 0x09: /* \t */
+ case 0x0a: /* \n */
+ case 0x0c: /* \f */
+ case 0x0d: /* \r */
+ case 0x20: /* */
+ case 0x23: /* # */
+ case 0xa0:
+ case 0xfeff:
+ return parse(str)
+ }
+ }
+
+ var url = Url !== undefined
+ ? new Url()
+ : {}
+ url.path = str
+ url.href = str
+ url.pathname = pathname
+ url.query = query
+ url.search = search
+
+ return url
+}
+
+/**
+ * Determine if parsed is still fresh for url.
+ *
+ * @param {string} url
+ * @param {object} parsedUrl
+ * @return {boolean}
+ * @private
+ */
+
+function fresh (url, parsedUrl) {
+ return typeof parsedUrl === 'object' &&
+ parsedUrl !== null &&
+ (Url === undefined || parsedUrl instanceof Url) &&
+ parsedUrl._raw === url
+}
diff --git a/node_modules/parseurl/package.json b/node_modules/parseurl/package.json
new file mode 100644
index 0000000..2741f9a
--- /dev/null
+++ b/node_modules/parseurl/package.json
@@ -0,0 +1,117 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "parseurl@~1.3.2",
+ "scope": null,
+ "escapedName": "parseurl",
+ "name": "parseurl",
+ "rawSpec": "~1.3.2",
+ "spec": ">=1.3.2 <1.4.0",
+ "type": "range"
+ },
+ "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/express"
+ ]
+ ],
+ "_from": "parseurl@>=1.3.2 <1.4.0",
+ "_id": "parseurl@1.3.2",
+ "_inCache": true,
+ "_location": "/parseurl",
+ "_nodeVersion": "6.11.1",
+ "_npmOperationalInternal": {
+ "host": "s3://npm-registry-packages",
+ "tmp": "tmp/parseurl-1.3.2.tgz_1504992079883_0.05658079497516155"
+ },
+ "_npmUser": {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ "_npmVersion": "3.10.10",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "parseurl@~1.3.2",
+ "scope": null,
+ "escapedName": "parseurl",
+ "name": "parseurl",
+ "rawSpec": "~1.3.2",
+ "spec": ">=1.3.2 <1.4.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/express",
+ "/finalhandler",
+ "/serve-static"
+ ],
+ "_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
+ "_shasum": "fc289d4ed8993119460c156253262cdc8de65bf3",
+ "_shrinkwrap": null,
+ "_spec": "parseurl@~1.3.2",
+ "_where": "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/express",
+ "bugs": {
+ "url": "https://github.com/pillarjs/parseurl/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "Jonathan Ong",
+ "email": "me@jongleberry.com",
+ "url": "http://jongleberry.com"
+ }
+ ],
+ "dependencies": {},
+ "description": "parse a url with memoization",
+ "devDependencies": {
+ "beautify-benchmark": "0.2.4",
+ "benchmark": "2.1.4",
+ "eslint": "3.19.0",
+ "eslint-config-standard": "10.2.1",
+ "eslint-plugin-import": "2.7.0",
+ "eslint-plugin-node": "5.1.1",
+ "eslint-plugin-promise": "3.5.0",
+ "eslint-plugin-standard": "3.0.1",
+ "fast-url-parser": "1.1.3",
+ "istanbul": "0.4.5",
+ "mocha": "2.5.3"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "fc289d4ed8993119460c156253262cdc8de65bf3",
+ "tarball": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "files": [
+ "LICENSE",
+ "HISTORY.md",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "0022a009d0973a44ae3849e83112ea4d12ad5b49",
+ "homepage": "https://github.com/pillarjs/parseurl#readme",
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "name": "parseurl",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/pillarjs/parseurl.git"
+ },
+ "scripts": {
+ "bench": "node benchmark/index.js",
+ "lint": "eslint .",
+ "test": "mocha --check-leaks --bail --reporter spec test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/"
+ },
+ "version": "1.3.2"
+}