avancement planning

This commit is contained in:
2026-05-26 11:58:39 +02:00
parent 619a2b240a
commit 150b97cd2e
4892 changed files with 99214 additions and 429382 deletions
+8 -18
View File
@@ -42,11 +42,16 @@ module.exports.match = mimeMatch
*/
function typeis (value, types_) {
// Backward compatibility. TODO: Remove.
if (value && typeof value === 'object') {
value = value.headers['content-type']
}
var i
var types = types_
// remove parameters and normalize
var val = tryNormalizeType(value)
var val = normalizeType(value)
// no type or invalid
if (!val) {
@@ -228,23 +233,8 @@ function mimeMatch (expected, actual) {
* @private
*/
function normalizeType (value) {
// Parse the type
var type = contentType.parse(value).type
if (!value) return null
var type = contentType.parse(value, { parameters: false }).type
return typer.test(type) ? type : null
}
/**
* Try to normalize a type and remove parameters.
*
* @param {string} value
* @return {(string|null)}
* @private
*/
function tryNormalizeType (value) {
try {
return value ? normalizeType(value) : null
} catch (err) {
return null
}
}
+9 -5
View File
@@ -1,31 +1,35 @@
{
"name": "type-is",
"description": "Infer the content-type of a request.",
"version": "2.0.1",
"version": "2.1.0",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
],
"license": "MIT",
"repository": "jshttp/type-is",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
},
"dependencies": {
"content-type": "^1.0.5",
"content-type": "^2.0.0",
"media-typer": "^1.1.0",
"mime-types": "^3.0.0"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-standard": "4.1.0",
"mocha": "9.2.1",
"mocha": "9.2.2",
"nyc": "15.1.0"
},
"engines": {
"node": ">= 0.6"
"node": ">= 18"
},
"files": [
"LICENSE",