-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
128 lines (128 loc) · 9.49 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{
"_args": [
[
{
"raw": "type-is@~1.6.17",
"scope": null,
"escapedName": "type-is",
"name": "type-is",
"rawSpec": "~1.6.17",
"spec": ">=1.6.17 <1.7.0",
"type": "range"
},
"C:\\Users\\nica_\\Desktop\\MI\\Anul III\\London Stock Spartans\\London Stock Spartans\\nodejs\\node_modules\\body-parser"
]
],
"_from": "type-is@~1.6.17",
"_hasShrinkwrap": false,
"_id": "type-is@1.6.18",
"_location": "/type-is",
"_nodeVersion": "8.16.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/type-is_1.6.18_1556287189103_0.20416863530873397"
},
"_npmUser": {
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
"_npmVersion": "6.4.1",
"_phantomChildren": {},
"_requested": {
"raw": "type-is@~1.6.17",
"scope": null,
"escapedName": "type-is",
"name": "type-is",
"rawSpec": "~1.6.17",
"spec": ">=1.6.17 <1.7.0",
"type": "range"
},
"_requiredBy": [
"/body-parser"
],
"_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"_shasum": "4e552cd05df09467dcbc4ef739de89f2cf37c131",
"_shrinkwrap": null,
"_spec": "type-is@~1.6.17",
"_where": "C:\\Users\\nica_\\Desktop\\MI\\Anul III\\London Stock Spartans\\London Stock Spartans\\nodejs\\node_modules\\body-parser",
"bugs": {
"url": "https://github.com/jshttp/type-is/issues"
},
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
{
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
}
],
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"description": "Infer the content-type of a request.",
"devDependencies": {
"eslint": "5.16.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-markdown": "1.0.0",
"eslint-plugin-node": "8.0.1",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-standard": "4.0.0",
"mocha": "6.1.4",
"nyc": "14.0.0"
},
"directories": {},
"dist": {
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"shasum": "4e552cd05df09467dcbc4ef739de89f2cf37c131",
"tarball": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"fileCount": 5,
"unpackedSize": 18497,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcww7VCRA9TVsSAnZWagAADo4P/isJIJ9PaSvaRKD2jXlI\nfnZaodUUUdgiQfzG0uL2nvb7F4iHg6ddCEG5ofw4MzDQAXpsmv2r7F/3CVE7\n6KvUo5mVJ/KngeH95DxUcef/bTTAbCFdht7gbTFpZ0UKM4Ow3iuvgyvz/3aI\nJgkxqw8WgY/IdFk5NVZ3g5x8kGWXD1Llf44LLptYZ3R9J2u73CDP3ft9nE1Y\np9NAu3X0NH11U6IFNS+T62hehOfdsJUjY1XZc6142m7KsXjiDxISiX2tj0kg\n1DsW7oOJeWnbOJSxxfiI4Np1T0gRupjYfFBg/Fsfl6p+qcOAgQYMZTqv2iR+\nWSD9QuL/QYiYKqfAiumnC3uxPkT6AUqohIzk5HUSXrJcuyCmFWNDIO3MllC7\nW+9Ac6+qkN+dMGRx9hWS632uyb6AxbbulXNPbv//JwGzSyu+gLSkOQgk0vto\ngMYi7HUbQQquVBftMs7OqZ3HiP4q1gMr1H4PuoUUQw1FzxgSi6gY8hJriqM/\nPSKVym4y0Umict5DJnirgtSIAArTLVHAmEcY1XRFJB43HLrkNdcCpVH6FfRh\nvZ3dQsN5HQA0ioRyCstwsjDAbEzYStPIXmBOdBFmNnRIMoBe/16HbNZbO208\nKODasC9g3GHFn/IGgr3h8gW+WD76ISD5zUFshm0w4eJGx9XKtzhhjicnm6PO\nO1q0\r\n=WOqY\r\n-----END PGP SIGNATURE-----\r\n"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"gitHead": "bfebe3d4ac312debccb7dbbc79242e2581dea5f0",
"homepage": "https://github.com/jshttp/type-is#readme",
"keywords": [
"content",
"type",
"checking"
],
"license": "MIT",
"maintainers": [
{
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
}
],
"name": "type-is",
"optionalDependencies": {},
"readme": "# type-is\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-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\nInfer the content-type of a request.\n\n### Install\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```sh\n$ npm install type-is\n```\n\n## API\n\n```js\nvar http = require('http')\nvar typeis = require('type-is')\n\nhttp.createServer(function (req, res) {\n var istext = typeis(req, ['text/*'])\n res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text')\n})\n```\n\n### typeis(request, types)\n\nChecks if the `request` is one of the `types`. If the request has no body,\neven if there is a `Content-Type` header, then `null` is returned. If the\n`Content-Type` header is invalid or does not matches any of the `types`, then\n`false` is returned. Otherwise, a string of the type that matched is returned.\n\nThe `request` argument is expected to be a Node.js HTTP request. The `types`\nargument is an array of type strings.\n\nEach type in the `types` array can be one of the following:\n\n- A file extension name such as `json`. This name will be returned if matched.\n- A mime type such as `application/json`.\n- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`.\n The full mime type will be returned if matched.\n- A suffix such as `+json`. This can be combined with a wildcard such as\n `*/vnd+json` or `application/*+json`. The full mime type will be returned\n if matched.\n\nSome examples to illustrate the inputs and returned value:\n\n<!-- eslint-disable no-undef -->\n\n```js\n// req.headers.content-type = 'application/json'\n\ntypeis(req, ['json']) // => 'json'\ntypeis(req, ['html', 'json']) // => 'json'\ntypeis(req, ['application/*']) // => 'application/json'\ntypeis(req, ['application/json']) // => 'application/json'\n\ntypeis(req, ['html']) // => false\n```\n\n### typeis.hasBody(request)\n\nReturns a Boolean if the given `request` has a body, regardless of the\n`Content-Type` header.\n\nHaving a body has no relation to how large the body is (it may be 0 bytes).\nThis is similar to how file existence works. If a body does exist, then this\nindicates that there is data to read from the Node.js request stream.\n\n<!-- eslint-disable no-undef -->\n\n```js\nif (typeis.hasBody(req)) {\n // read the body, since there is one\n\n req.on('data', function (chunk) {\n // ...\n })\n}\n```\n\n### typeis.is(mediaType, types)\n\nChecks if the `mediaType` is one of the `types`. If the `mediaType` is invalid\nor does not matches any of the `types`, then `false` is returned. Otherwise, a\nstring of the type that matched is returned.\n\nThe `mediaType` argument is expected to be a\n[media type](https://tools.ietf.org/html/rfc6838) string. The `types` argument\nis an array of type strings.\n\nEach type in the `types` array can be one of the following:\n\n- A file extension name such as `json`. This name will be returned if matched.\n- A mime type such as `application/json`.\n- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`.\n The full mime type will be returned if matched.\n- A suffix such as `+json`. This can be combined with a wildcard such as\n `*/vnd+json` or `application/*+json`. The full mime type will be returned\n if matched.\n\nSome examples to illustrate the inputs and returned value:\n\n<!-- eslint-disable no-undef -->\n\n```js\nvar mediaType = 'application/json'\n\ntypeis.is(mediaType, ['json']) // => 'json'\ntypeis.is(mediaType, ['html', 'json']) // => 'json'\ntypeis.is(mediaType, ['application/*']) // => 'application/json'\ntypeis.is(mediaType, ['application/json']) // => 'application/json'\n\ntypeis.is(mediaType, ['html']) // => false\n```\n\n## Examples\n\n### Example body parser\n\n```js\nvar express = require('express')\nvar typeis = require('type-is')\n\nvar app = express()\n\napp.use(function bodyParser (req, res, next) {\n if (!typeis.hasBody(req)) {\n return next()\n }\n\n switch (typeis(req, ['urlencoded', 'json', 'multipart'])) {\n case 'urlencoded':\n // parse urlencoded body\n throw new Error('implement urlencoded body parsing')\n case 'json':\n // parse json body\n throw new Error('implement json body parsing')\n case 'multipart':\n // parse multipart body\n throw new Error('implement multipart body parsing')\n default:\n // 415 error code\n res.statusCode = 415\n res.end()\n break\n }\n})\n```\n\n## License\n\n[MIT](LICENSE)\n\n[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/type-is/master\n[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master\n[node-version-image]: https://badgen.net/npm/node/type-is\n[node-version-url]: https://nodejs.org/en/download\n[npm-downloads-image]: https://badgen.net/npm/dm/type-is\n[npm-url]: https://npmjs.org/package/type-is\n[npm-version-image]: https://badgen.net/npm/v/type-is\n[travis-image]: https://badgen.net/travis/jshttp/type-is/master\n[travis-url]: https://travis-ci.org/jshttp/type-is\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/type-is.git"
},
"scripts": {
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"test-travis": "nyc --reporter=text npm test"
},
"version": "1.6.18"
}