From f04f0d24d1bc71aec9c8674f755038e02032776b Mon Sep 17 00:00:00 2001 From: Ayoub-Mabrouk Date: Mon, 11 Nov 2024 01:34:17 +0100 Subject: [PATCH] Refactor normalizeType function to simplify return statement --- index.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index a5f1109..834ed16 100644 --- a/index.js +++ b/index.js @@ -232,19 +232,14 @@ function mimeMatch (expected, actual) { * Normalize a type and remove parameters. * * @param {string} value - * @return {string} + * @return {(string|null)} * @private */ - function normalizeType (value) { - // parse the type + // Parse the type var type = contentType.parse(value).type - if (!typer.test(type)) { - return null - } - - return type + return typer.test(type) ? type : null } /**