From 91ce1a92c4994237236a1af9f99471bf07c54c99 Mon Sep 17 00:00:00 2001 From: Jorge Date: Sat, 24 Jul 2021 10:55:23 +0200 Subject: [PATCH] fix: fix lint problems --- .vscode/settings.json | 3 ++- lib/index.js | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e7ddcac..4ad7355 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ - "execa" + "execa", + "formdata" ] } \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index a8aeebe..c0734e3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -166,25 +166,25 @@ function parseBody (body = {}, method) { 'text/plain': {} } break - case "formdata": + case 'formdata': content = { - "multipart/form-data": { - schema: { - type: "object", - properties: body.formdata.reduce((acc, v) => { - acc[v.key] = { type: v.type === 'text' ? 'string' : v.type }; - if (v.hasOwnProperty("description")) { - acc[v.key].description = v.description == '' ? 'Description' : v.description; - } - if (v.hasOwnProperty("value") && v.value !== '') { - acc[v.key].example = v.value; - }; - return acc; - }, {}) - } + 'multipart/form-data': { + schema: { + type: 'object', + properties: body.formdata.reduce((acc, v) => { + acc[v.key] = { type: v.type === 'text' ? 'string' : v.type } + if (Object.prototype.hasOwnProperty.call(v, 'description')) { + acc[v.key].description = v.description === '' ? 'Description' : v.description + } + if (Object.prototype.hasOwnProperty.call(v, 'value') && v.value !== '') { + acc[v.key].example = v.value + }; + return acc + }, {}) } - }; - break; + } + } + break } return { requestBody: { content } } }