Closed GrosSacASac closed 3 years ago
I will review it soon.
An utility to force get singular values
const firstValuesOfFields = fields => {
return Object.fromEntries(Object.entries(fields).map(([key, value]) => {
return [key, value[0]];
}));
};
// ...
form.parse(request, async (err, fieldsM /*files*/) => {
const fields = firstValuesOfFields(fieldsM);
remove multiples remove unused qs and querystring dependency
files and fields are always arrays to avoid type errors use modern URLSearchParams https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams internally