blob: db035f25f552bd192755100df3e90daf5d058d04 [file] [log] [blame]
{
"_args": [
[
{
"raw": "encodeurl@~1.0.1",
"scope": null,
"escapedName": "encodeurl",
"name": "encodeurl",
"rawSpec": "~1.0.1",
"spec": ">=1.0.1 <1.1.0",
"type": "range"
},
"/Users/steveng/repo/cordova/cordova-browser/node_modules/express"
]
],
"_from": "encodeurl@>=1.0.1 <1.1.0",
"_id": "encodeurl@1.0.1",
"_inCache": true,
"_location": "/encodeurl",
"_nodeVersion": "4.4.3",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/encodeurl-1.0.1.tgz_1465519736251_0.09314409433864057"
},
"_npmUser": {
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
"_npmVersion": "2.15.1",
"_phantomChildren": {},
"_requested": {
"raw": "encodeurl@~1.0.1",
"scope": null,
"escapedName": "encodeurl",
"name": "encodeurl",
"rawSpec": "~1.0.1",
"spec": ">=1.0.1 <1.1.0",
"type": "range"
},
"_requiredBy": [
"/express",
"/finalhandler",
"/send",
"/serve-static"
],
"_resolved": "http://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz",
"_shasum": "79e3d58655346909fe6f0f45a5de68103b294d20",
"_shrinkwrap": null,
"_spec": "encodeurl@~1.0.1",
"_where": "/Users/steveng/repo/cordova/cordova-browser/node_modules/express",
"bugs": {
"url": "https://github.com/pillarjs/encodeurl/issues"
},
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
}
],
"dependencies": {},
"description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences",
"devDependencies": {
"eslint": "2.11.1",
"eslint-config-standard": "5.3.1",
"eslint-plugin-promise": "1.3.2",
"eslint-plugin-standard": "1.3.2",
"istanbul": "0.4.3",
"mocha": "2.5.3"
},
"directories": {},
"dist": {
"shasum": "79e3d58655346909fe6f0f45a5de68103b294d20",
"tarball": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz"
},
"engines": {
"node": ">= 0.8"
},
"files": [
"LICENSE",
"HISTORY.md",
"README.md",
"index.js"
],
"gitHead": "39ed0c235fed4cea7d012038fd6bb0480561d226",
"homepage": "https://github.com/pillarjs/encodeurl#readme",
"keywords": [
"encode",
"encodeurl",
"url"
],
"license": "MIT",
"maintainers": [
{
"name": "dougwilson",
"email": "doug@somethingdoug.com"
}
],
"name": "encodeurl",
"optionalDependencies": {},
"readme": "# encodeurl\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nEncode a URL to a percent-encoded form, excluding already-encoded sequences\n\n## Installation\n\n```sh\n$ npm install encodeurl\n```\n\n## API\n\n```js\nvar encodeUrl = require('encodeurl')\n```\n\n### encodeUrl(url)\n\nEncode a URL to a percent-encoded form, excluding already-encoded sequences.\n\nThis function will take an already-encoded URL and encode all the non-URL\ncode points (as UTF-8 byte sequences). This function will not encode the\n\"%\" character unless it is not part of a valid sequence (`%20` will be\nleft as-is, but `%foo` will be encoded as `%25foo`).\n\nThis encode is meant to be \"safe\" and does not throw errors. It will try as\nhard as it can to properly encode the given URL, including replacing any raw,\nunpaired surrogate pairs with the Unicode replacement character prior to\nencoding.\n\nThis function is _similar_ to the intrinsic function `encodeURI`, except it\nwill not encode the `%` character if that is part of a valid sequence, will\nnot encode `[` and `]` (for IPv6 hostnames) and will replace raw, unpaired\nsurrogate pairs with the Unicode replacement character (instead of throwing).\n\n## Examples\n\n### Encode a URL containing user-controled data\n\n```js\nvar encodeUrl = require('encodeurl')\nvar escapeHtml = require('escape-html')\n\nhttp.createServer(function onRequest (req, res) {\n // get encoded form of inbound url\n var url = encodeUrl(req.url)\n\n // create html message\n var body = '<p>Location ' + escapeHtml(url) + ' not found</p>'\n\n // send a 404\n res.statusCode = 404\n res.setHeader('Content-Type', 'text/html; charset=UTF-8')\n res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))\n res.end(body, 'utf-8')\n})\n```\n\n### Encode a URL for use in a header field\n\n```js\nvar encodeUrl = require('encodeurl')\nvar escapeHtml = require('escape-html')\nvar url = require('url')\n\nhttp.createServer(function onRequest (req, res) {\n // parse inbound url\n var href = url.parse(req)\n\n // set new host for redirect\n href.host = 'localhost'\n href.protocol = 'https:'\n href.slashes = true\n\n // create location header\n var location = encodeUrl(url.format(href))\n\n // create html message\n var body = '<p>Redirecting to new site: ' + escapeHtml(location) + '</p>'\n\n // send a 301\n res.statusCode = 301\n res.setHeader('Content-Type', 'text/html; charset=UTF-8')\n res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))\n res.setHeader('Location', location)\n res.end(body, 'utf-8')\n})\n```\n\n## Testing\n\n```sh\n$ npm test\n$ npm run lint\n```\n\n## References\n\n- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax][rfc-3986]\n- [WHATWG URL Living Standard][whatwg-url]\n\n[rfc-3986]: https://tools.ietf.org/html/rfc3986\n[whatwg-url]: https://url.spec.whatwg.org/\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/encodeurl.svg\n[npm-url]: https://npmjs.org/package/encodeurl\n[node-version-image]: https://img.shields.io/node/v/encodeurl.svg\n[node-version-url]: https://nodejs.org/en/download\n[travis-image]: https://img.shields.io/travis/pillarjs/encodeurl.svg\n[travis-url]: https://travis-ci.org/pillarjs/encodeurl\n[coveralls-image]: https://img.shields.io/coveralls/pillarjs/encodeurl.svg\n[coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/encodeurl.svg\n[downloads-url]: https://npmjs.org/package/encodeurl\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/pillarjs/encodeurl.git"
},
"scripts": {
"lint": "eslint **/*.js",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
},
"version": "1.0.1"
}